@dvmkit/sdk 0.14.2 → 0.15.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.
- package/dist/{chunk-FL6Q3JNJ.js → chunk-KVKJ7R5V.js} +56 -2
- package/dist/{chunk-R3FSW66G.js → chunk-PKLNMMKF.js} +38 -12
- package/dist/{chunk-PJAKJD2U.js → chunk-YMMCRQ2H.js} +30 -8
- package/dist/{chunk-VG74TVFF.js → chunk-ZJRGORJ3.js} +97 -24
- package/dist/{content-retention-DA2mlW31.d.ts → content-retention-BASsjgKw.d.ts} +1 -1
- package/dist/{credit-menu-BXHL3jHA.d.ts → credit-menu-B239nIY5.d.ts} +13 -6
- package/dist/{fx-UnO-P6Cj.d.ts → fx-BmvWGISH.d.ts} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/internal/caller.d.ts +11 -7
- package/dist/internal/server.d.ts +7 -7
- package/dist/internal/server.js +4 -4
- package/dist/{job-store-AxjHh5Gp.d.ts → job-store-CA7u1nHV.d.ts} +11 -3
- package/dist/{lightning-backend-C5_GKiKR.d.ts → lightning-backend-BOcopzXk.d.ts} +1 -1
- package/dist/{postgres-job-store-VDSDXCHR.js → postgres-job-store-IXTNWT4K.js} +2 -2
- package/dist/server/index.d.ts +14 -12
- package/dist/server/index.js +5 -5
- package/dist/{step-cache-MA3hpa7F.d.ts → step-cache-BCRHimiY.d.ts} +23 -1
- package/dist/testing/index.d.ts +7 -4
- package/dist/testing/index.js +2 -2
- package/dist/{usd-CLGrKw9p.d.ts → usd-B8_WMfHT.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -26,6 +26,7 @@ function toJobRecord(job) {
|
|
|
26
26
|
awaitingInputAtMs: job.awaitingInputAtMs,
|
|
27
27
|
messages: job.messages,
|
|
28
28
|
seq: job.seq,
|
|
29
|
+
upfrontPayment: job.upfrontPayment,
|
|
29
30
|
paidMsats: job.paidMsats,
|
|
30
31
|
paymentMint: job.paymentMint,
|
|
31
32
|
paymentRail: job.paymentRail,
|
|
@@ -77,6 +78,7 @@ function fromJobRecord(record) {
|
|
|
77
78
|
awaitingInputAtMs: record.awaitingInputAtMs,
|
|
78
79
|
messages: [...record.messages],
|
|
79
80
|
seq: record.seq,
|
|
81
|
+
upfrontPayment: record.upfrontPayment,
|
|
80
82
|
paidMsats: record.paidMsats,
|
|
81
83
|
paymentMint: record.paymentMint,
|
|
82
84
|
paymentRail: record.paymentRail,
|
|
@@ -163,7 +165,51 @@ function providerMessage(job, type, content) {
|
|
|
163
165
|
}
|
|
164
166
|
job.messageAppender?.(msg, type === "prompt" ? { awaitingInput: job.status === "awaiting-input" } : void 0);
|
|
165
167
|
}
|
|
168
|
+
var historyHolds = /* @__PURE__ */ new WeakMap();
|
|
169
|
+
var heldNotifications = /* @__PURE__ */ new WeakMap();
|
|
170
|
+
function holdJobHistory(job, seq) {
|
|
171
|
+
let holds = historyHolds.get(job);
|
|
172
|
+
if (!holds) {
|
|
173
|
+
holds = /* @__PURE__ */ new Set();
|
|
174
|
+
historyHolds.set(job, holds);
|
|
175
|
+
}
|
|
176
|
+
holds.add(seq);
|
|
177
|
+
}
|
|
178
|
+
function visibleJobMessages(job) {
|
|
179
|
+
const holds = historyHolds.get(job);
|
|
180
|
+
if (!holds?.size) return job.messages;
|
|
181
|
+
const boundary = Math.min(...holds);
|
|
182
|
+
return job.messages.filter((message) => message.seq < boundary);
|
|
183
|
+
}
|
|
184
|
+
function releaseJobHistory(job, seq, accepted) {
|
|
185
|
+
const holds = historyHolds.get(job);
|
|
186
|
+
const wasPending = holds?.delete(seq);
|
|
187
|
+
if (accepted && wasPending) {
|
|
188
|
+
const next = job.messages.findIndex((existing) => existing.seq > accepted.seq);
|
|
189
|
+
job.messages.splice(next < 0 ? job.messages.length : next, 0, accepted);
|
|
190
|
+
const queued = heldNotifications.get(job) ?? [];
|
|
191
|
+
queued.push(accepted);
|
|
192
|
+
heldNotifications.set(job, queued);
|
|
193
|
+
}
|
|
194
|
+
flushJobHistory(job);
|
|
195
|
+
}
|
|
196
|
+
function flushJobHistory(job) {
|
|
197
|
+
const holds = historyHolds.get(job);
|
|
198
|
+
const boundary = holds?.size ? Math.min(...holds) : Infinity;
|
|
199
|
+
const queued = heldNotifications.get(job) ?? [];
|
|
200
|
+
queued.sort((a, b) => a.seq - b.seq);
|
|
201
|
+
heldNotifications.set(job, queued.filter((message) => message.seq >= boundary));
|
|
202
|
+
for (const message of queued) {
|
|
203
|
+
if (message.seq < boundary) {
|
|
204
|
+
for (const listener of job.listeners) listener(message);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
166
208
|
function localMessage(job, from, type, content) {
|
|
209
|
+
if (type === "cancel" || type === "complete") {
|
|
210
|
+
historyHolds.get(job)?.clear();
|
|
211
|
+
flushJobHistory(job);
|
|
212
|
+
}
|
|
167
213
|
job.seq++;
|
|
168
214
|
const msg = {
|
|
169
215
|
seq: job.seq,
|
|
@@ -173,8 +219,13 @@ function localMessage(job, from, type, content) {
|
|
|
173
219
|
content
|
|
174
220
|
};
|
|
175
221
|
job.messages.push(msg);
|
|
176
|
-
|
|
177
|
-
|
|
222
|
+
const holds = historyHolds.get(job);
|
|
223
|
+
if (holds?.size && msg.seq >= Math.min(...holds)) {
|
|
224
|
+
const queued = heldNotifications.get(job) ?? [];
|
|
225
|
+
queued.push(msg);
|
|
226
|
+
heldNotifications.set(job, queued);
|
|
227
|
+
} else {
|
|
228
|
+
for (const listener of job.listeners) listener(msg);
|
|
178
229
|
}
|
|
179
230
|
return msg;
|
|
180
231
|
}
|
|
@@ -270,6 +321,9 @@ export {
|
|
|
270
321
|
abortJob,
|
|
271
322
|
JobCancelledError,
|
|
272
323
|
providerMessage,
|
|
324
|
+
holdJobHistory,
|
|
325
|
+
visibleJobMessages,
|
|
326
|
+
releaseJobHistory,
|
|
273
327
|
localMessage,
|
|
274
328
|
isTerminal,
|
|
275
329
|
isYieldMessage,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
callerDeadline,
|
|
5
5
|
hasCallerDeadline,
|
|
6
6
|
isTerminal
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KVKJ7R5V.js";
|
|
8
8
|
import {
|
|
9
9
|
redactUrl
|
|
10
10
|
} from "./chunk-FUJ36YDV.js";
|
|
@@ -116,7 +116,10 @@ var MemoryJobStore = class {
|
|
|
116
116
|
return Promise.resolve();
|
|
117
117
|
}
|
|
118
118
|
const snapshot = structuredClone(record);
|
|
119
|
-
if (existing)
|
|
119
|
+
if (existing) {
|
|
120
|
+
snapshot.createdAt = existing.createdAt;
|
|
121
|
+
snapshot.upfrontPayment = structuredClone(existing.upfrontPayment);
|
|
122
|
+
}
|
|
120
123
|
if (existing && isTerminal(existing.status)) snapshot.lastActivityAt = existing.lastActivityAt;
|
|
121
124
|
if (existing?.receipt) snapshot.receipt = existing.receipt;
|
|
122
125
|
snapshot.timingKnown = existing ? existing.timingKnown ?? false : record.timingKnown ?? true;
|
|
@@ -125,6 +128,7 @@ var MemoryJobStore = class {
|
|
|
125
128
|
const cur = this.nextSeq.get(record.id) ?? 1;
|
|
126
129
|
this.nextSeq.set(record.id, Math.max(cur, record.seq + 1));
|
|
127
130
|
if (isTerminal(record.status)) {
|
|
131
|
+
this.notify(record.id);
|
|
128
132
|
this.messages.delete(record.id);
|
|
129
133
|
}
|
|
130
134
|
return Promise.resolve();
|
|
@@ -236,7 +240,7 @@ var MemoryJobStore = class {
|
|
|
236
240
|
}
|
|
237
241
|
if (!isTerminal(record.status)) record.lastActivityAt = Date.now();
|
|
238
242
|
if (seq > record.seq) record.seq = seq;
|
|
239
|
-
this.notify(jobId
|
|
243
|
+
this.notify(jobId);
|
|
240
244
|
return Promise.resolve(seq);
|
|
241
245
|
}
|
|
242
246
|
recordInbound(jobId, message) {
|
|
@@ -297,7 +301,7 @@ var MemoryJobStore = class {
|
|
|
297
301
|
}
|
|
298
302
|
}
|
|
299
303
|
if (!isTerminal(record.status)) record.lastActivityAt = Date.now();
|
|
300
|
-
this.notify(jobId
|
|
304
|
+
this.notify(jobId);
|
|
301
305
|
return Promise.resolve({
|
|
302
306
|
counters: snapshotCounters(record),
|
|
303
307
|
alreadyVerified: false,
|
|
@@ -318,6 +322,7 @@ var MemoryJobStore = class {
|
|
|
318
322
|
const stored = this.messagesFor(jobId).find((m) => m.message.seq === seq);
|
|
319
323
|
if (stored?.status === "pending-verification") {
|
|
320
324
|
stored.status = "failed-verify";
|
|
325
|
+
this.notify(jobId);
|
|
321
326
|
}
|
|
322
327
|
return Promise.resolve();
|
|
323
328
|
}
|
|
@@ -408,11 +413,8 @@ var MemoryJobStore = class {
|
|
|
408
413
|
if (subSet.size === 0) this.notifySubscribers.delete(jobId);
|
|
409
414
|
});
|
|
410
415
|
}
|
|
411
|
-
getMessages(jobId, afterSeq) {
|
|
412
|
-
|
|
413
|
-
return Promise.resolve(
|
|
414
|
-
stored.filter((m) => m.status === "verified" && m.message.seq > afterSeq).map((m) => m.message)
|
|
415
|
-
);
|
|
416
|
+
getMessages(jobId, afterSeq, options) {
|
|
417
|
+
return Promise.resolve(this.visibleMessages(jobId, afterSeq, options?.includeHeld));
|
|
416
418
|
}
|
|
417
419
|
initStreaming() {
|
|
418
420
|
return Promise.resolve();
|
|
@@ -458,7 +460,7 @@ var MemoryJobStore = class {
|
|
|
458
460
|
record.messages = [...terminalMessages, cancelMsg];
|
|
459
461
|
record.seq = seq;
|
|
460
462
|
record.lastActivityAt = Date.now();
|
|
461
|
-
this.notify(jobId
|
|
463
|
+
this.notify(jobId);
|
|
462
464
|
this.messages.delete(jobId);
|
|
463
465
|
return Promise.resolve(true);
|
|
464
466
|
}
|
|
@@ -475,11 +477,35 @@ var MemoryJobStore = class {
|
|
|
475
477
|
}
|
|
476
478
|
return list;
|
|
477
479
|
}
|
|
478
|
-
|
|
480
|
+
visibleMessages(jobId, afterSeq, includeHeld = false) {
|
|
481
|
+
const stored = this.messagesFor(jobId);
|
|
482
|
+
const record = this.data.get(jobId);
|
|
483
|
+
const terminal = record && isTerminal(record.status);
|
|
484
|
+
const terminalMessage = stored.some((entry) => entry.status === "verified" && entry.message.from === "provider" && (entry.message.type === "complete" || entry.message.type === "cancel"));
|
|
485
|
+
let boundary = Infinity;
|
|
486
|
+
if (!includeHeld && !terminal && !terminalMessage) {
|
|
487
|
+
for (const entry of stored) {
|
|
488
|
+
if (entry.status === "pending-verification" && entry.message.type === "payment") {
|
|
489
|
+
boundary = Math.min(boundary, entry.message.seq);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
const messages = /* @__PURE__ */ new Map();
|
|
494
|
+
if (terminal) {
|
|
495
|
+
for (const message of record.messages) if (message.seq > afterSeq) messages.set(message.seq, message);
|
|
496
|
+
}
|
|
497
|
+
for (const entry of stored) {
|
|
498
|
+
if (entry.status === "verified" && entry.message.seq > afterSeq && entry.message.seq < boundary) {
|
|
499
|
+
messages.set(entry.message.seq, entry.message);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
return [...messages.values()].sort((a, b) => a.seq - b.seq);
|
|
503
|
+
}
|
|
504
|
+
notify(jobId) {
|
|
479
505
|
const subs = this.messageSubscribers.get(jobId);
|
|
480
506
|
if (subs) {
|
|
481
507
|
for (const sub of subs) {
|
|
482
|
-
|
|
508
|
+
for (const message of this.visibleMessages(jobId, sub.afterSeq)) {
|
|
483
509
|
sub.afterSeq = message.seq;
|
|
484
510
|
sub.cb(message);
|
|
485
511
|
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
applyContentHoldMutation,
|
|
4
4
|
callerDeadline,
|
|
5
5
|
hasCallerDeadline
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KVKJ7R5V.js";
|
|
7
7
|
import {
|
|
8
8
|
withSdkInitLock
|
|
9
9
|
} from "./chunk-COYKJRMM.js";
|
|
@@ -263,6 +263,7 @@ var PostgresJobStore = class {
|
|
|
263
263
|
-- with a fund-and-draw response. INSERT-only for replay stability.
|
|
264
264
|
ALTER TABLE jobs ADD COLUMN IF NOT EXISTS funding_receipt JSONB;
|
|
265
265
|
ALTER TABLE jobs ADD COLUMN IF NOT EXISTS funding_credit JSONB;
|
|
266
|
+
ALTER TABLE jobs ADD COLUMN IF NOT EXISTS upfront_payment JSONB;
|
|
266
267
|
-- the outstanding mid-job ask, denominated in fiat micro at the
|
|
267
268
|
-- instant it was emitted. The top-up's ledger leg funds and grows the
|
|
268
269
|
-- draw in this figure, so it must not move with the BTC/USD rate between
|
|
@@ -550,8 +551,8 @@ var PostgresJobStore = class {
|
|
|
550
551
|
last_activity_at, next_seq, requester_token_hash, requester_token,
|
|
551
552
|
request_fingerprint, requester_pubkey, request_id, credit_id, draw_id,
|
|
552
553
|
pending_payment_fiat_micro, pending_payment_fiat_currency, auth_request_path,
|
|
553
|
-
funding_receipt, funding_credit, dvm_id, terminal_at_ms, caller_wait_ms, awaiting_input_at_ms, ended_by, timing_known
|
|
554
|
-
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$51)
|
|
554
|
+
funding_receipt, funding_credit, dvm_id, terminal_at_ms, caller_wait_ms, awaiting_input_at_ms, ended_by, timing_known, upfront_payment
|
|
555
|
+
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$51,$52)
|
|
555
556
|
ON CONFLICT (id) DO UPDATE SET
|
|
556
557
|
terminal_at_ms = COALESCE(jobs.terminal_at_ms, EXCLUDED.terminal_at_ms),
|
|
557
558
|
ended_by = CASE WHEN jobs.status IN ('completed', 'failed', 'cancelled') THEN jobs.ended_by ELSE EXCLUDED.ended_by END,
|
|
@@ -690,7 +691,8 @@ var PostgresJobStore = class {
|
|
|
690
691
|
record.status === "awaiting-input" ? record.awaitingInputAtMs ?? now : null,
|
|
691
692
|
isTerminalStatus(record.status) && record.status !== "completed" ? record.endedBy ?? "provider" : null,
|
|
692
693
|
now,
|
|
693
|
-
record.timingKnown ?? true
|
|
694
|
+
record.timingKnown ?? true,
|
|
695
|
+
record.upfrontPayment ? JSON.stringify(record.upfrontPayment) : null
|
|
694
696
|
]
|
|
695
697
|
);
|
|
696
698
|
let rowCount;
|
|
@@ -729,6 +731,7 @@ var PostgresJobStore = class {
|
|
|
729
731
|
return;
|
|
730
732
|
}
|
|
731
733
|
if (record.status === "completed" || record.status === "failed" || record.status === "cancelled") {
|
|
734
|
+
await this.pool.query("SELECT pg_notify('job_messages', $1)", [record.id]).catch(() => void 0);
|
|
732
735
|
await this.deleteResolvedMessages(record.id).catch(() => void 0);
|
|
733
736
|
}
|
|
734
737
|
}
|
|
@@ -1197,7 +1200,11 @@ var PostgresJobStore = class {
|
|
|
1197
1200
|
}
|
|
1198
1201
|
async markInboundFailed(jobId, seq, _reason) {
|
|
1199
1202
|
await this.pool.query(
|
|
1200
|
-
|
|
1203
|
+
`WITH failed AS (
|
|
1204
|
+
UPDATE job_messages SET status='failed-verify'
|
|
1205
|
+
WHERE job_id = $1 AND seq = $2 AND status = 'pending-verification'
|
|
1206
|
+
RETURNING job_id
|
|
1207
|
+
) SELECT pg_notify('job_messages', job_id) FROM failed`,
|
|
1201
1208
|
[jobId, seq]
|
|
1202
1209
|
);
|
|
1203
1210
|
}
|
|
@@ -1316,10 +1323,24 @@ var PostgresJobStore = class {
|
|
|
1316
1323
|
if (subSet.size === 0) this.notifySubscribers.delete(jobId);
|
|
1317
1324
|
});
|
|
1318
1325
|
}
|
|
1319
|
-
async getMessages(jobId, afterSeq) {
|
|
1326
|
+
async getMessages(jobId, afterSeq, options) {
|
|
1320
1327
|
const { rows } = await this.pool.query(
|
|
1321
|
-
|
|
1322
|
-
|
|
1328
|
+
`WITH terminal AS (
|
|
1329
|
+
SELECT messages FROM jobs WHERE id = $1 AND status IN ('completed', 'failed', 'cancelled')
|
|
1330
|
+
), history AS (
|
|
1331
|
+
SELECT seq, data, 0 AS origin FROM job_messages
|
|
1332
|
+
WHERE job_id = $1 AND seq > $2 AND status = 'verified'
|
|
1333
|
+
AND ($3::boolean OR EXISTS (SELECT 1 FROM terminal)
|
|
1334
|
+
OR EXISTS (SELECT 1 FROM job_messages WHERE job_id = $1 AND status = 'verified'
|
|
1335
|
+
AND data->>'from' = 'provider' AND data->>'type' IN ('complete', 'cancel'))
|
|
1336
|
+
OR seq < COALESCE((SELECT MIN(seq) FROM job_messages
|
|
1337
|
+
WHERE job_id = $1 AND status = 'pending-verification' AND data->>'type' = 'payment'), 9223372036854775807))
|
|
1338
|
+
UNION ALL
|
|
1339
|
+
SELECT (message->>'seq')::bigint, message, 1 AS origin
|
|
1340
|
+
FROM terminal CROSS JOIN LATERAL jsonb_array_elements(terminal.messages) AS snapshot(message)
|
|
1341
|
+
WHERE (message->>'seq')::bigint > $2
|
|
1342
|
+
) SELECT DISTINCT ON (seq) data FROM history ORDER BY seq, origin`,
|
|
1343
|
+
[jobId, afterSeq, options?.includeHeld ?? false]
|
|
1323
1344
|
);
|
|
1324
1345
|
return rows.map((r) => typeof r.data === "string" ? JSON.parse(r.data) : r.data);
|
|
1325
1346
|
}
|
|
@@ -1547,6 +1568,7 @@ function rowToRecord(row) {
|
|
|
1547
1568
|
summary: row.summary,
|
|
1548
1569
|
messages: row.messages,
|
|
1549
1570
|
seq: row.seq,
|
|
1571
|
+
upfrontPayment: row.upfront_payment ?? void 0,
|
|
1550
1572
|
paidMsats: Number(row.paid_msats),
|
|
1551
1573
|
paymentMint: row.payment_mint,
|
|
1552
1574
|
paymentRail: row.payment_rail ?? void 0,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./chunk-33J3NQDZ.js";
|
|
21
21
|
import {
|
|
22
22
|
PostgresJobStore
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-YMMCRQ2H.js";
|
|
24
24
|
import {
|
|
25
25
|
SIGNED_ENVELOPE_FIELDS,
|
|
26
26
|
SignedRequestError,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
isJobRetentionStore,
|
|
38
38
|
isReceiptIssuingStore,
|
|
39
39
|
isStreamableJobStore
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-PKLNMMKF.js";
|
|
41
41
|
import {
|
|
42
42
|
ContentHoldError,
|
|
43
43
|
JobCancelledError,
|
|
@@ -47,13 +47,16 @@ import {
|
|
|
47
47
|
contentMetadata,
|
|
48
48
|
fromJobRecord,
|
|
49
49
|
hasCallerDeadline,
|
|
50
|
+
holdJobHistory,
|
|
50
51
|
isContentHoldStore,
|
|
51
52
|
isTerminal,
|
|
52
53
|
isYieldMessage,
|
|
53
54
|
localMessage,
|
|
54
55
|
providerMessage,
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
releaseJobHistory,
|
|
57
|
+
toJobRecord,
|
|
58
|
+
visibleJobMessages
|
|
59
|
+
} from "./chunk-KVKJ7R5V.js";
|
|
57
60
|
import {
|
|
58
61
|
ADMIN_AUTH_CLOCK_SKEW_SECONDS,
|
|
59
62
|
ADMIN_AUTH_NONCE_TTL_SECONDS,
|
|
@@ -3183,6 +3186,26 @@ function isRecord(value) {
|
|
|
3183
3186
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
3184
3187
|
}
|
|
3185
3188
|
|
|
3189
|
+
// src/sdk/server/upfront-payment.ts
|
|
3190
|
+
function upfrontPaymentFromDraw(draw) {
|
|
3191
|
+
const value = draw.railValue;
|
|
3192
|
+
const rail = value.rail;
|
|
3193
|
+
return {
|
|
3194
|
+
amount_msats: value.drawMsats,
|
|
3195
|
+
...value.creditCurrency !== null && {
|
|
3196
|
+
amount_micro: draw.amountMicro,
|
|
3197
|
+
currency: value.creditCurrency
|
|
3198
|
+
},
|
|
3199
|
+
...rail === "cashu" || rail === "x402" || rail === "tempo" || rail === "lightning" ? { rail } : {},
|
|
3200
|
+
...value.drawNative !== null && value.nativeAsset !== null && {
|
|
3201
|
+
native_amount: value.drawNative,
|
|
3202
|
+
native_asset: value.nativeAsset
|
|
3203
|
+
},
|
|
3204
|
+
credit_id: draw.creditId,
|
|
3205
|
+
draw_id: draw.drawId
|
|
3206
|
+
};
|
|
3207
|
+
}
|
|
3208
|
+
|
|
3186
3209
|
// src/sdk/server/payment-diagnostics.ts
|
|
3187
3210
|
import { Errors } from "mppx";
|
|
3188
3211
|
function paymentFailureFields(error) {
|
|
@@ -3562,7 +3585,18 @@ async function issueUpfrontChallenges(mpp, requiredMsats, resourcePath, btcUsdRa
|
|
|
3562
3585
|
);
|
|
3563
3586
|
}
|
|
3564
3587
|
async function verifyUpfrontPayment(opts) {
|
|
3565
|
-
|
|
3588
|
+
const result = await withPaymentDiagnostics(() => verifyUpfrontPaymentInScope(opts));
|
|
3589
|
+
if (!result.error && !result.replayedDraw && !result.upfrontPayment && !opts.fundOnly) {
|
|
3590
|
+
result.upfrontPayment = {
|
|
3591
|
+
amount_msats: result.paidMsats,
|
|
3592
|
+
...result.paymentRail && { rail: result.paymentRail },
|
|
3593
|
+
...result.nativeAmount !== void 0 && result.nativeAsset !== void 0 && {
|
|
3594
|
+
native_amount: result.nativeAmount,
|
|
3595
|
+
native_asset: result.nativeAsset
|
|
3596
|
+
}
|
|
3597
|
+
};
|
|
3598
|
+
}
|
|
3599
|
+
return result;
|
|
3566
3600
|
}
|
|
3567
3601
|
async function verifyUpfrontPaymentInScope(opts) {
|
|
3568
3602
|
const {
|
|
@@ -4330,7 +4364,8 @@ async function verifyUpfrontPaymentInScope(opts) {
|
|
|
4330
4364
|
creditId: draw.creditId,
|
|
4331
4365
|
drawId: draw.drawId,
|
|
4332
4366
|
drawAmountMicro: draw.amountMicro,
|
|
4333
|
-
creditCurrency: ledgerCtx.priceFiat.currency
|
|
4367
|
+
creditCurrency: ledgerCtx.priceFiat.currency,
|
|
4368
|
+
upfrontPayment: upfrontPaymentFromDraw(draw)
|
|
4334
4369
|
};
|
|
4335
4370
|
} catch (err) {
|
|
4336
4371
|
if (err instanceof CreditLedgerError) return creditLedgerErrorResult(err, x402Requirements);
|
|
@@ -5157,7 +5192,9 @@ async function verifyIncomingPaymentInScope(body, opts, snapshot) {
|
|
|
5157
5192
|
};
|
|
5158
5193
|
}
|
|
5159
5194
|
}
|
|
5160
|
-
return {
|
|
5195
|
+
return { error: { status: 402, body: paymentErrorBody("payment_invalid", {
|
|
5196
|
+
message: "Payment method is not configured"
|
|
5197
|
+
}) } };
|
|
5161
5198
|
}
|
|
5162
5199
|
function midJobFundedMsats(snapshot, railMsats) {
|
|
5163
5200
|
const pending = snapshot.pendingPaymentMsats ?? 0;
|
|
@@ -5966,7 +6003,8 @@ function withDrawBasis(info, ctx, committed) {
|
|
|
5966
6003
|
const withDraw = {
|
|
5967
6004
|
...base2,
|
|
5968
6005
|
drawId,
|
|
5969
|
-
drawAmountMicro: draw.amountMicro
|
|
6006
|
+
drawAmountMicro: draw.amountMicro,
|
|
6007
|
+
...!ctx.midJob && !ctx.fundOnly && { upfrontPayment: upfrontPaymentFromDraw(draw) }
|
|
5970
6008
|
};
|
|
5971
6009
|
if (!ctx.drawBasis) return withDraw;
|
|
5972
6010
|
const { drawMsats, drawNative } = committed.added ?? draw.railValue;
|
|
@@ -13474,6 +13512,7 @@ var JobManager = class {
|
|
|
13474
13512
|
// Bind live resolvers and recovery scaffolds to the store-allocated ask identity.
|
|
13475
13513
|
paymentAskSeqs = /* @__PURE__ */ new WeakMap();
|
|
13476
13514
|
reactivationAskSeqs = /* @__PURE__ */ new WeakMap();
|
|
13515
|
+
pendingPaymentMessages = /* @__PURE__ */ new WeakMap();
|
|
13477
13516
|
// Every local input resume holds this queue through its durable wait update.
|
|
13478
13517
|
// A prompt response and a payment NOTIFY must not mistake each other for a
|
|
13479
13518
|
// different machine's successful claim.
|
|
@@ -13799,6 +13838,7 @@ var JobManager = class {
|
|
|
13799
13838
|
status: "processing",
|
|
13800
13839
|
messages: [],
|
|
13801
13840
|
seq: 0,
|
|
13841
|
+
upfrontPayment: payment.upfrontPayment ? structuredClone(payment.upfrontPayment) : void 0,
|
|
13802
13842
|
paidMsats: payment.paidMsats,
|
|
13803
13843
|
paymentMint: payment.paymentMint,
|
|
13804
13844
|
paymentRail: payment.paymentRail,
|
|
@@ -14050,7 +14090,7 @@ var JobManager = class {
|
|
|
14050
14090
|
if (await this.adoptDurableTerminal(job)) return;
|
|
14051
14091
|
const record = toJobRecord(job);
|
|
14052
14092
|
if (isTerminal(job.status) && isStreamableJobStore(this.jobStore)) {
|
|
14053
|
-
const durable = await this.jobStore.getMessages(job.id, 0);
|
|
14093
|
+
const durable = await this.jobStore.getMessages(job.id, 0, { includeHeld: true });
|
|
14054
14094
|
if (durable.length >= record.messages.length) {
|
|
14055
14095
|
record.messages = durable;
|
|
14056
14096
|
const highSeq = durable.length ? durable[durable.length - 1].seq : record.seq;
|
|
@@ -15139,8 +15179,9 @@ var JobManager = class {
|
|
|
15139
15179
|
}
|
|
15140
15180
|
}
|
|
15141
15181
|
/**
|
|
15142
|
-
* Record an inbound client message durably via Tx B
|
|
15143
|
-
*
|
|
15182
|
+
* Record an inbound client message durably via Tx B. Payments stay outside
|
|
15183
|
+
* visible history until processPayment accepts them; other messages append
|
|
15184
|
+
* to `job.messages` immediately. Returns the DB-allocated seq
|
|
15144
15185
|
* (`null` when the store isn't streamable — non-Postgres test fallback).
|
|
15145
15186
|
*
|
|
15146
15187
|
* Status starts as `pending-verification`; a follow-up Tx C call
|
|
@@ -15159,13 +15200,24 @@ var JobManager = class {
|
|
|
15159
15200
|
});
|
|
15160
15201
|
}
|
|
15161
15202
|
job.seq++;
|
|
15162
|
-
|
|
15203
|
+
const message = {
|
|
15163
15204
|
seq: job.seq,
|
|
15164
15205
|
from: "requester",
|
|
15165
15206
|
timestamp,
|
|
15166
15207
|
type: msgType,
|
|
15167
15208
|
content: msgContent
|
|
15168
|
-
}
|
|
15209
|
+
};
|
|
15210
|
+
if (msgType === "payment") {
|
|
15211
|
+
let pending = this.pendingPaymentMessages.get(job);
|
|
15212
|
+
if (!pending) {
|
|
15213
|
+
pending = /* @__PURE__ */ new Map();
|
|
15214
|
+
this.pendingPaymentMessages.set(job, pending);
|
|
15215
|
+
}
|
|
15216
|
+
pending.set(txSeq ?? msgContent, message);
|
|
15217
|
+
holdJobHistory(job, message.seq);
|
|
15218
|
+
} else {
|
|
15219
|
+
job.messages.push(message);
|
|
15220
|
+
}
|
|
15169
15221
|
job.lastActivityAt = Date.now();
|
|
15170
15222
|
return txSeq;
|
|
15171
15223
|
}
|
|
@@ -15274,6 +15326,22 @@ var JobManager = class {
|
|
|
15274
15326
|
* 500. See `creditInbound`.
|
|
15275
15327
|
*/
|
|
15276
15328
|
async processPayment(job, body, inboundSeq, extra) {
|
|
15329
|
+
const pending = this.pendingPaymentMessages.get(job);
|
|
15330
|
+
const key = inboundSeq ?? body.content;
|
|
15331
|
+
const message = pending?.get(key);
|
|
15332
|
+
let accepted;
|
|
15333
|
+
try {
|
|
15334
|
+
const outcome = await this.processPaymentAndCredit(job, body, inboundSeq, extra);
|
|
15335
|
+
if (!outcome.error && message && pending?.get(key) === message) {
|
|
15336
|
+
accepted = message;
|
|
15337
|
+
}
|
|
15338
|
+
return outcome;
|
|
15339
|
+
} finally {
|
|
15340
|
+
pending?.delete(key);
|
|
15341
|
+
if (message) releaseJobHistory(job, message.seq, accepted);
|
|
15342
|
+
}
|
|
15343
|
+
}
|
|
15344
|
+
async processPaymentAndCredit(job, body, inboundSeq, extra) {
|
|
15277
15345
|
if (body.type !== "payment") return {};
|
|
15278
15346
|
const devAuto = this.opts.devMode === true && body.content.dev_auto === true && !hasPaymentProof(body.content);
|
|
15279
15347
|
if (devAuto || devModeSkipsPaymentVerification(this.opts)) {
|
|
@@ -15358,7 +15426,7 @@ var JobManager = class {
|
|
|
15358
15426
|
};
|
|
15359
15427
|
}
|
|
15360
15428
|
const info = verifyResult.verified;
|
|
15361
|
-
if (!info) return {};
|
|
15429
|
+
if (!info) return { error: { status: 402, body: { error: "payment_invalid", message: "Payment was not accepted" } } };
|
|
15362
15430
|
const drawFundingReceipt = await this.drawFundingReceiptFor(info.drawFunding, info.funding?.currency);
|
|
15363
15431
|
let unappliedCredit;
|
|
15364
15432
|
const fullyUnapplied = info.unappliedMicro !== void 0 && info.funding !== void 0 && info.unappliedMicro >= info.funding.amountMicro;
|
|
@@ -23610,14 +23678,21 @@ var DVMServer = class {
|
|
|
23610
23678
|
const job = this.jobManager.activeJobs.get(id);
|
|
23611
23679
|
const after = Number(c.req.query("after") ?? "0");
|
|
23612
23680
|
const accept = c.req.header("Accept") ?? "";
|
|
23613
|
-
|
|
23614
|
-
|
|
23681
|
+
const store = this.jobManager.store;
|
|
23682
|
+
if (job && !isJobOwner(c, job)) return c.json({ error: "Job not found" }, 404);
|
|
23683
|
+
if (!job || isStreamableJobStore(store)) {
|
|
23684
|
+
if (job) await job.messageAppenderTail;
|
|
23615
23685
|
const record = await store.get(id);
|
|
23616
23686
|
if (!record) return c.json({ error: "Job not found" }, 404);
|
|
23617
23687
|
if (!isJobOwner(c, record)) return c.json({ error: "Job not found" }, 404);
|
|
23618
|
-
const
|
|
23688
|
+
const terminal = isTerminal(record.status) || job !== void 0 && isTerminal(job.status);
|
|
23689
|
+
let filtered = record.messages.filter((m) => m.seq > after);
|
|
23690
|
+
if (isStreamableJobStore(store)) {
|
|
23691
|
+
const durable = await store.getMessages(id, after, { includeHeld: terminal });
|
|
23692
|
+
if (durable.length > 0 || !terminal) filtered = durable;
|
|
23693
|
+
}
|
|
23619
23694
|
if (accept.includes("text/event-stream")) {
|
|
23620
|
-
if (isStreamableJobStore(store) && !
|
|
23695
|
+
if (isStreamableJobStore(store) && !terminal) {
|
|
23621
23696
|
return streamSSE(c, async (stream) => {
|
|
23622
23697
|
let unsubFn;
|
|
23623
23698
|
await new Promise((resolve) => {
|
|
@@ -23680,10 +23755,6 @@ var DVMServer = class {
|
|
|
23680
23755
|
}
|
|
23681
23756
|
});
|
|
23682
23757
|
}
|
|
23683
|
-
if (isStreamableJobStore(store) && !isTerminal(record.status)) {
|
|
23684
|
-
const msgs = await store.getMessages(id, after);
|
|
23685
|
-
if (msgs.length > 0) return c.json(await this.messageFields(record, msgs));
|
|
23686
|
-
}
|
|
23687
23758
|
return c.json(await this.messageFields(record, filtered));
|
|
23688
23759
|
}
|
|
23689
23760
|
if (!isJobOwner(c, job)) return c.json({ error: "Job not found" }, 404);
|
|
@@ -23691,7 +23762,7 @@ var DVMServer = class {
|
|
|
23691
23762
|
const fields = await this.contentFields(job);
|
|
23692
23763
|
return streamSSE(c, async (stream) => {
|
|
23693
23764
|
if (fields.content_available === false) return;
|
|
23694
|
-
const existing = job.
|
|
23765
|
+
const existing = visibleJobMessages(job).filter((m) => m.seq > after);
|
|
23695
23766
|
let yielded = false;
|
|
23696
23767
|
for (const msg of existing) {
|
|
23697
23768
|
await stream.writeSSE({ data: JSON.stringify(msg), event: "message" });
|
|
@@ -23719,7 +23790,7 @@ var DVMServer = class {
|
|
|
23719
23790
|
});
|
|
23720
23791
|
});
|
|
23721
23792
|
}
|
|
23722
|
-
return c.json(await this.messageFields(job, job.
|
|
23793
|
+
return c.json(await this.messageFields(job, visibleJobMessages(job).filter((m) => m.seq > after)));
|
|
23723
23794
|
}
|
|
23724
23795
|
jobNotActiveResponse(c) {
|
|
23725
23796
|
return c.json(
|
|
@@ -24095,6 +24166,7 @@ function recordedDrawPayment(draw, opts) {
|
|
|
24095
24166
|
...rail === "cashu" ? { cashuFlow: "p2pk_accumulator" } : {},
|
|
24096
24167
|
creditId: draw.creditId,
|
|
24097
24168
|
drawId: draw.drawId,
|
|
24169
|
+
upfrontPayment: upfrontPaymentFromDraw(draw),
|
|
24098
24170
|
drawAmountMicro: draw.amountMicro,
|
|
24099
24171
|
...draw.railValue.creditCurrency ? { creditCurrency: draw.railValue.creditCurrency } : {}
|
|
24100
24172
|
};
|
|
@@ -24180,6 +24252,7 @@ function removeUnavailableContent(fields) {
|
|
|
24180
24252
|
}
|
|
24181
24253
|
function terminalResponseFields(job) {
|
|
24182
24254
|
const fields = {};
|
|
24255
|
+
if (job.upfrontPayment !== void 0) fields.upfront_payment = job.upfrontPayment;
|
|
24183
24256
|
if (job.status === "completed") {
|
|
24184
24257
|
if (job.summary !== void 0) fields.summary = job.summary;
|
|
24185
24258
|
const artifactCount = job.messages.filter((m) => m.type === "artifact").length;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { f as LockPubkey, e as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-
|
|
2
|
-
import {
|
|
1
|
+
import { f as LockPubkey, e as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-BOcopzXk.js';
|
|
2
|
+
import { cp as HostingCleanupFence, da as HostedIntent, al as FundingMethod, p as PaymentMethod, bV as CreditLedgerLike, a7 as Message, O as UpfrontPayment, a1 as FundingReceipt, bX as CreditSnapshot, a2 as JobReceipt, S as SDKJobContext, az as StepCache, v as ResponseContent, P as PaymentContent, a3 as MessageType, bq as X402Receipt, aI as X402Config, bp as X402ExactVersionSupport, db as X402SettlementIntent, ad as PaymentRequirementsV2, dc as HostedFundingReservation, bR as CreditLedgerQuerier, dd as X402SettlementCursor, b$ as X402SettlementStatus, de as X402SettlementWriteOff, bW as X402RefundSettlementGate, df as X402FacilitatorAuth, dg as X402BatchSettlementConfig, cM as PostgresX402ChannelStorage, dh as X402PayoutObserver, bT as HostedSettlementReportObligations, bt as CreditDepositPayload, by as MppxServer, ag as CashuMode, di as CreditDepositEnqueue, dj as X402SettlementReconciliationReason, as as PaymentRequirements, c3 as FundingRecord, a5 as MppxCredential, b_ as DrawResult, cz as CreditLedgerError, a9 as ReceiptCredit, ai as DrainReceiptEvent, aa as DrainReceipt, a0 as DrawFundingReceipt, K as KVStore, z as SignedRequestAudience, dk as CreditDrawReleaseEnqueue, cK as JobCostReportPayload, cL as JobTerminalReportPayload, cO as RevenueSkippedNoRailPayload, Z as ZodLike, a as DVMDescriptor, c5 as CreditInvoiceRecord, c6 as InvoiceSettlement, ct as ClientCompatibilityGate, cr as ClientCompatibility, bC as PostgresTempoSessionStore, bB as PayoutReporter, R as ResolvedCreditConfig, h as CreditView } from './step-cache-BCRHimiY.js';
|
|
3
3
|
import { ProofLike, SerializedDLEQ, Proof } from '@cashu/cashu-ts';
|
|
4
4
|
import { Hono, Context } from 'hono';
|
|
5
5
|
import { Pool } from 'pg';
|
|
6
|
-
import { d as FxSourceFailure, b as FxRateSnapshot, F as FxFetcher } from './fx-
|
|
6
|
+
import { d as FxSourceFailure, b as FxRateSnapshot, F as FxFetcher } from './fx-BmvWGISH.js';
|
|
7
7
|
import { Store, Challenge } from 'mppx';
|
|
8
|
-
import { T as TopUpCapUnenforcedReason, A as AppendOutgoingOptions, J as JobRecord, b as JobStore } from './job-store-
|
|
8
|
+
import { T as TopUpCapUnenforcedReason, A as AppendOutgoingOptions, J as JobRecord, b as JobStore } from './job-store-CA7u1nHV.js';
|
|
9
9
|
import { SettleResponse, SupportedResponse } from '@x402/core/types';
|
|
10
10
|
import { Channel, AutoSettlementConfig } from '@x402/evm/batch-settlement/server';
|
|
11
11
|
import { FacilitatorClient } from '@x402/core/server';
|
|
@@ -477,6 +477,8 @@ interface ServerJob {
|
|
|
477
477
|
summary?: string;
|
|
478
478
|
messages: Message[];
|
|
479
479
|
seq: number;
|
|
480
|
+
/** Original acceptance snapshot; absent for historical records. INSERT-only. */
|
|
481
|
+
upfrontPayment?: UpfrontPayment;
|
|
480
482
|
paidMsats: number;
|
|
481
483
|
paymentMint?: string;
|
|
482
484
|
/** Rail of the most recent successful credit. Set on each credit branch in payment processing. */
|
|
@@ -1750,6 +1752,8 @@ interface CreateX402BatchSettlementServerOpts {
|
|
|
1750
1752
|
declare function createX402BatchSettlementServer(opts: CreateX402BatchSettlementServerOpts): Promise<X402BatchSettlementServer>;
|
|
1751
1753
|
|
|
1752
1754
|
interface PaymentInfo {
|
|
1755
|
+
/** Immutable acceptance fact, separate from cumulative job accounting. */
|
|
1756
|
+
upfrontPayment?: UpfrontPayment;
|
|
1753
1757
|
/**
|
|
1754
1758
|
* Rail value this payment contributes to the job, in millisatoshis.
|
|
1755
1759
|
*
|
|
@@ -2977,6 +2981,7 @@ declare class JobManager<State, InputSchema extends ZodLike | undefined> {
|
|
|
2977
2981
|
private readonly statusChecksQueued;
|
|
2978
2982
|
private readonly paymentAskSeqs;
|
|
2979
2983
|
private readonly reactivationAskSeqs;
|
|
2984
|
+
private readonly pendingPaymentMessages;
|
|
2980
2985
|
private readonly inputResumeTails;
|
|
2981
2986
|
private readonly claimedPaymentResumes;
|
|
2982
2987
|
private readonly sessionId;
|
|
@@ -3476,8 +3481,9 @@ declare class JobManager<State, InputSchema extends ZodLike | undefined> {
|
|
|
3476
3481
|
*/
|
|
3477
3482
|
claimAwaitingInputForReactivation(jobId: string): Promise<boolean>;
|
|
3478
3483
|
/**
|
|
3479
|
-
* Record an inbound client message durably via Tx B
|
|
3480
|
-
*
|
|
3484
|
+
* Record an inbound client message durably via Tx B. Payments stay outside
|
|
3485
|
+
* visible history until processPayment accepts them; other messages append
|
|
3486
|
+
* to `job.messages` immediately. Returns the DB-allocated seq
|
|
3481
3487
|
* (`null` when the store isn't streamable — non-Postgres test fallback).
|
|
3482
3488
|
*
|
|
3483
3489
|
* Status starts as `pending-verification`; a follow-up Tx C call
|
|
@@ -3555,6 +3561,7 @@ declare class JobManager<State, InputSchema extends ZodLike | undefined> {
|
|
|
3555
3561
|
lockPubkeys?: LockPubkey[];
|
|
3556
3562
|
mintHealthTracker?: MintHealthTracker;
|
|
3557
3563
|
}): Promise<ProcessPaymentOutcome>;
|
|
3564
|
+
private processPaymentAndCredit;
|
|
3558
3565
|
/** Issue (or reuse) the signed draw funding receipt for a committed funding row; never throws. */
|
|
3559
3566
|
private drawFundingReceiptFor;
|
|
3560
3567
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as Currency, Z as ZodLike, D as DVMConfig, a as DVMDescriptor } from './step-cache-
|
|
2
|
-
export { A as ApprovalContent, b as ArtifactContent, c as CancelContent, d as CanonicalEnvelope, e as CapabilityRate, f as CreateSignedRequestVerifierOpts, g as CreditConfig, h as CreditView, i as DEFAULT_CREDIT_MAX, j as DEFAULT_CREDIT_MIN, k as DEFAULT_CREDIT_TTL_SECONDS, l as DEFAULT_JOB_RETENTION_DAYS, m as DVMRouteContext, I as IncomingMessage, n as InputType, o as InvalidCurrencyError, J as JobCost, K as KVStore, L as Logger, P as PaymentContent, p as PaymentMethod, q as PriceValue, r as ProgressContent, s as PromptOpts, Q as QuoteConfig, t as QuoteContext, u as QuoteResult, R as ResolvedCreditConfig, v as ResponseContent, S as SDKJobContext, w as SDKPaymentRequestOpts, x as SIGNED_REQUEST_AUTH_ID, y as SIGNED_REQUEST_STATEMENT_VERSION, z as SignedRequestAudience, B as SignedRequestDomain, E as SignedRequestError, F as SignedRequestFailure, G as SignedRequestReplayStore, H as SignedRequestSignOpts, M as SignedRequestStatementHeader, N as SignedRequestVerifier, U as UnsupportedCurrencyError, O as
|
|
3
|
-
export { C as CreateFxFetcherOpts, D as DEFAULT_FX_CURRENCIES, a as DEFAULT_FX_RATE_SOURCE, F as FxFetcher, b as FxRateSnapshot, c as FxRateUnavailableError, d as FxSourceFailure, e as FxSourceFailureCategory, P as PlatformFxSource, f as createFxFetcher, g as fxRateFor, r as resolveFxSourceFromEnv } from './fx-
|
|
4
|
-
export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-
|
|
5
|
-
export { J as JobRecord, a as JobStatus, b as JobStore } from './job-store-
|
|
1
|
+
import { C as Currency, Z as ZodLike, D as DVMConfig, a as DVMDescriptor } from './step-cache-BCRHimiY.js';
|
|
2
|
+
export { A as ApprovalContent, b as ArtifactContent, c as CancelContent, d as CanonicalEnvelope, e as CapabilityRate, f as CreateSignedRequestVerifierOpts, g as CreditConfig, h as CreditView, i as DEFAULT_CREDIT_MAX, j as DEFAULT_CREDIT_MIN, k as DEFAULT_CREDIT_TTL_SECONDS, l as DEFAULT_JOB_RETENTION_DAYS, m as DVMRouteContext, I as IncomingMessage, n as InputType, o as InvalidCurrencyError, J as JobCost, K as KVStore, L as Logger, P as PaymentContent, p as PaymentMethod, q as PriceValue, r as ProgressContent, s as PromptOpts, Q as QuoteConfig, t as QuoteContext, u as QuoteResult, R as ResolvedCreditConfig, v as ResponseContent, S as SDKJobContext, w as SDKPaymentRequestOpts, x as SIGNED_REQUEST_AUTH_ID, y as SIGNED_REQUEST_STATEMENT_VERSION, z as SignedRequestAudience, B as SignedRequestDomain, E as SignedRequestError, F as SignedRequestFailure, G as SignedRequestReplayStore, H as SignedRequestSignOpts, M as SignedRequestStatementHeader, N as SignedRequestVerifier, U as UnsupportedCurrencyError, O as UpfrontPayment, T as createSignedRequestVerifier, V as isZodSchema, W as signedRequestStatementHeader, X as validateCurrency } from './step-cache-BCRHimiY.js';
|
|
3
|
+
export { C as CreateFxFetcherOpts, D as DEFAULT_FX_CURRENCIES, a as DEFAULT_FX_RATE_SOURCE, F as FxFetcher, b as FxRateSnapshot, c as FxRateUnavailableError, d as FxSourceFailure, e as FxSourceFailureCategory, P as PlatformFxSource, f as createFxFetcher, g as fxRateFor, r as resolveFxSourceFromEnv } from './fx-BmvWGISH.js';
|
|
4
|
+
export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-B8_WMfHT.js';
|
|
5
|
+
export { J as JobRecord, a as JobStatus, b as JobStore } from './job-store-CA7u1nHV.js';
|
|
6
6
|
export { P as PinnedFetch, S as SSRFError, a as SSRFGuardOpts, b as SSRFReason, c as SSRFResolver, d as assertSafeUrl, e as createPinnedFetch } from './ssrf-dMooihtY.js';
|
|
7
7
|
export { z } from 'zod';
|
|
8
8
|
import 'hono';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { Y as JsonValue, B as SignedRequestDomain, M as SignedRequestStatementHeader, _ as X402_BATCH_SETTLEMENT_SCHEME, $ as X402_EXACT_SCHEME, a0 as DrawFundingReceipt, a1 as FundingReceipt, a2 as JobReceipt$1, O as UpfrontPayment, a3 as MessageType, a4 as X402Version, a5 as MppxCredential, z as SignedRequestAudience, a6 as PaymentRequired, a7 as Message, a8 as MppxChallenge, a9 as ReceiptCredit, aa as DrainReceipt, C as Currency, ab as X402Wallet, ac as PaymentRequirementsV1, ad as PaymentRequirementsV2, L as Logger$1, K as KVStore } from '../step-cache-BCRHimiY.js';
|
|
2
|
+
export { ae as BuildPaymentRequirementsOpts, af as CapabilityDescriptor, ag as CashuMode, ah as CompleteContent, ai as DrainReceiptEvent, aj as ExactEvmPayload, ak as ExactEvmPayloadAuthorization, al as FundingMethod, am as MessageFrom, an as PaymentPayload, ao as PaymentPayloadV1, ap as PaymentPayloadV2, aq as PaymentRequestContent, ar as PaymentRequiredV2, as as PaymentRequirements, at as PromptContent, au as RAIL_REFUNDABLE, av as ReceiptOutcome, aw as ReceiptPayment, ax as ResourceInfo, ay as SettleResponse, az as StepCache, aA as StepRecord, aB as TextContent, aC as UnsignedDrainReceipt, aD as UnsignedDrawFundingReceipt, aE as UnsignedFundingReceipt, aF as UnsignedJobReceipt, aG as VerifyResponse, aH as WorkingContent, aI as X402Config, aJ as X402ResponseBody, aK as X402SelfRelayRpcFailureReason, aL as X402_DEFAULT_NETWORK, aM as X402_V1_VERSION, aN as X402_VERSION, aO as buildPaymentRequiredV2, aP as buildPaymentRequirements, aQ as caip2ToX402Network, aR as canonicalRequestPath, aS as canonicaliseForSigning, aT as canonicalize, aU as chainIdFromCaip2, aV as computeResultHash, aW as decodePayment, aX as decodePaymentRequiredHeader, aY as encodePayment, aZ as encodePaymentRequiredHeader, a_ as encodeSettleResponseHeader, a$ as exactEvmAuthorization, b0 as isArtifactMessage, b1 as isCancelMessage, b2 as isCompleteMessage, b3 as isDrainReceipt, b4 as isDrawFundingReceipt, b5 as isFundingReceipt, b6 as isPaymentRequestMessage, b7 as isPromptMessage, b8 as isSignedJobReceipt, b9 as isTextMessage, ba as isWorkingMessage, bb as paymentRequiredV2FromV1, bc as signDrainReceipt, bd as signDrawFundingReceipt, be as signFundingReceipt, bf as signReceipt, bg as usdcContractByCaip2, bh as usdcContractFor, bi as usdcDomainNameFor, bj as usdcDomainVersionFor, bk as verifyDrainReceipt, bl as verifyDrawFundingReceipt, bm as verifyFundingReceipt, bn as verifyReceipt, bo as x402NetworkToCaip2 } from '../step-cache-BCRHimiY.js';
|
|
3
|
+
import { L as LightningTransactionListOptions, a as LightningTransactionSnapshot, b as LightningBackend, c as LightningPayment, d as LightningWalletInfo, C as CreatedInvoice, I as InvoiceStatus } from '../lightning-backend-BOcopzXk.js';
|
|
4
|
+
export { A as AttestationPayload, B as BuilderIdentityKeypair, e as CheckMintHealthOptions, f as LockPubkey, M as MintAmountBounds, g as MintHealthCheckResult, h as amountBoundsVerdict, i as assertNutSupport, j as buildAttestation, k as canSwap, l as checkMintHealth, m as generateIdentity, n as hashCapabilities, o as loadIdentitySecret, p as meltAmountBounds, s as signAttestation, t as toLockPubkey, v as verifyAttestation, w as writeIdentity } from '../lightning-backend-BOcopzXk.js';
|
|
3
5
|
import { ProofLike, MeltQuoteBolt11Response, Proof, Wallet, MintQuoteBolt11Response, MintPreview, CounterSource, CounterRange, SerializedDLEQ, OutputData, OutputDataLike } from '@cashu/cashu-ts';
|
|
4
6
|
export { g as getWallet } from '../wallet-Dwjs5n_M.js';
|
|
5
|
-
import { X as JsonValue, B as SignedRequestDomain, M as SignedRequestStatementHeader, Y as X402_BATCH_SETTLEMENT_SCHEME, _ as X402_EXACT_SCHEME, $ as DrawFundingReceipt, a0 as FundingReceipt, a1 as JobReceipt$1, a2 as MessageType, a3 as X402Version, a4 as MppxCredential, z as SignedRequestAudience, a5 as PaymentRequired, a6 as Message, a7 as MppxChallenge, a8 as ReceiptCredit, a9 as DrainReceipt, C as Currency, aa as X402Wallet, ab as PaymentRequirementsV1, ac as PaymentRequirementsV2, L as Logger$1, K as KVStore } from '../step-cache-MA3hpa7F.js';
|
|
6
|
-
export { ad as BuildPaymentRequirementsOpts, ae as CapabilityDescriptor, af as CashuMode, ag as CompleteContent, ah as DrainReceiptEvent, ai as ExactEvmPayload, aj as ExactEvmPayloadAuthorization, ak as FundingMethod, al as MessageFrom, am as PaymentPayload, an as PaymentPayloadV1, ao as PaymentPayloadV2, ap as PaymentRequestContent, aq as PaymentRequiredV2, ar as PaymentRequirements, as as PromptContent, at as RAIL_REFUNDABLE, au as ReceiptOutcome, av as ReceiptPayment, aw as ResourceInfo, ax as SettleResponse, ay as StepCache, az as StepRecord, aA as TextContent, aB as UnsignedDrainReceipt, aC as UnsignedDrawFundingReceipt, aD as UnsignedFundingReceipt, aE as UnsignedJobReceipt, aF as VerifyResponse, aG as WorkingContent, aH as X402Config, aI as X402ResponseBody, aJ as X402SelfRelayRpcFailureReason, aK as X402_DEFAULT_NETWORK, aL as X402_V1_VERSION, aM as X402_VERSION, aN as buildPaymentRequiredV2, aO as buildPaymentRequirements, aP as caip2ToX402Network, aQ as canonicalRequestPath, aR as canonicaliseForSigning, aS as canonicalize, aT as chainIdFromCaip2, aU as computeResultHash, aV as decodePayment, aW as decodePaymentRequiredHeader, aX as encodePayment, aY as encodePaymentRequiredHeader, aZ as encodeSettleResponseHeader, a_ as exactEvmAuthorization, a$ as isArtifactMessage, b0 as isCancelMessage, b1 as isCompleteMessage, b2 as isDrainReceipt, b3 as isDrawFundingReceipt, b4 as isFundingReceipt, b5 as isPaymentRequestMessage, b6 as isPromptMessage, b7 as isSignedJobReceipt, b8 as isTextMessage, b9 as isWorkingMessage, ba as paymentRequiredV2FromV1, bb as signDrainReceipt, bc as signDrawFundingReceipt, bd as signFundingReceipt, be as signReceipt, bf as usdcContractByCaip2, bg as usdcContractFor, bh as usdcDomainNameFor, bi as usdcDomainVersionFor, bj as verifyDrainReceipt, bk as verifyDrawFundingReceipt, bl as verifyFundingReceipt, bm as verifyReceipt, bn as x402NetworkToCaip2 } from '../step-cache-MA3hpa7F.js';
|
|
7
7
|
import { SimplePool } from 'nostr-tools/pool';
|
|
8
8
|
import { Session } from 'mppx/tempo';
|
|
9
9
|
import { Pool } from 'pg';
|
|
10
10
|
import { PaymentRequired as PaymentRequired$1 } from '@x402/core/types';
|
|
11
11
|
import { ClientChannelStorage, BatchSettlementClientContext, BatchSettlementEvmScheme } from '@x402/evm/batch-settlement/client';
|
|
12
|
-
export { h as FX_CACHE_TTL_MS, i as FX_RETRY_COUNT, w as warmFxSnapshot } from '../fx-
|
|
13
|
-
export { c as InvalidUsdPriceError, p as parseUsdPrice } from '../usd-
|
|
12
|
+
export { h as FX_CACHE_TTL_MS, i as FX_RETRY_COUNT, w as warmFxSnapshot } from '../fx-BmvWGISH.js';
|
|
13
|
+
export { c as InvalidUsdPriceError, p as parseUsdPrice } from '../usd-B8_WMfHT.js';
|
|
14
14
|
import 'hono';
|
|
15
15
|
import 'mppx';
|
|
16
16
|
import '@x402/core/server';
|
|
@@ -1346,6 +1346,8 @@ interface CreditOpResult {
|
|
|
1346
1346
|
* response; that one is a single block inside it.
|
|
1347
1347
|
*/
|
|
1348
1348
|
interface JobReceipt {
|
|
1349
|
+
/** Original accepted payment/hold. Absent means unknown, never zero. */
|
|
1350
|
+
upfrontPayment?: UpfrontPayment;
|
|
1349
1351
|
jobId: string;
|
|
1350
1352
|
status: "completed" | "processing" | "payment-required" | "failed" | "cancelled" | "awaiting-input";
|
|
1351
1353
|
/** Tempo settlement transaction from the validated `Payment-Receipt` header. */
|
|
@@ -1421,6 +1423,8 @@ interface OutboundMessage {
|
|
|
1421
1423
|
content: Record<string, unknown>;
|
|
1422
1424
|
}
|
|
1423
1425
|
interface JobStatus {
|
|
1426
|
+
/** Original accepted payment/hold, unchanged by later payments or settlement. */
|
|
1427
|
+
upfrontPayment?: UpfrontPayment;
|
|
1424
1428
|
jobId: string;
|
|
1425
1429
|
status: "processing" | "completed" | "failed" | "awaiting-input" | "cancelled";
|
|
1426
1430
|
/** Human-readable summary of the completed job (one-liner; not the payload). Present when status is `completed`. */
|
|
@@ -6500,4 +6504,4 @@ declare class MemoryKVStore implements KVStore {
|
|
|
6500
6504
|
list(prefix?: string): Promise<string[]>;
|
|
6501
6505
|
}
|
|
6502
6506
|
|
|
6503
|
-
export { ADMIN_STATE_UNAVAILABLE, AGENT_MNEMONIC_FILE, type AgentProof, type AgentRecentSpend, type AgentWallet, type AttestedDvmIdentity, BTC_RATE_FILE, BUDGET_FILE, type BudgetCaps, type BudgetCheckResult, type BudgetLedger, type BudgetLedgerEntry, type BudgetSpendBreakdown, type BudgetSpendKind, type BudgetWindow, type BuilderLockKeypair, CAPABILITY_NAME_RE, COINGECKO_SIMPLE_PRICE_URL, CONFIG_AUDIT_FILE, CONFIG_BACKUP_FILE, CONFIG_DIR, CONFIG_FILE, CONFIG_PINNED_FILE, CREDITS_FILE, CREDIT_DRAIN_RAILS, CREDIT_FUNDING_MODES, CREDIT_FUND_RAILS, type CachedBtcRate, type CancelOptions, type CliIdentityEntry, type CoinGeckoBtcSpot, type CoinGeckoSpot, type CompletedCreditHistoryPage, type CompletedCreditHistoryQuery, type CompletedCreditHistoryRecord, type CompletedRefundHistoryRecord, type ConfigDirModeResult, CreatedInvoice, type CreditDrainRail, type CreditFundRail, type CreditFundingMode, type CreditMenu, type CreditOpResult, type CreditTerms, type CreditWire, DEFAULT_AGENT_MINT_URL, DIAGNOSTIC_CATALOGUE_VERSION, DbTransport, type DeliveredResult, type DescribeOptions, type DiagnosticCapabilityAuthority, type DiagnosticIdentityAuthority, DrainReceipt, type DrainReceiptChecks, type DrainReceiptVerifyResult, type DrainWire, DrawFundingReceipt, type DrawFundingReceiptChecks, type DrawFundingReceiptVerifyResult, type DrawFundingRejection, DvmError, DvmX402ChannelStorage, type ExpiredCreditLossHistoryRecord, FAVORITES_FILE, FEEDBACK_NUDGES_FILE, type FundValuation, FundingReceipt, type FundingReceiptChecks, type FundingReceiptVerifyResult, IDENTITIES_FILE, IDENTITIES_VERSION, type IdentitiesFile, InvoiceStatus, JOBS_FILE, JOB_IDENTITY_HEADER, type JobEnvelope, type JobIdentityHeaderResult, type JobPolicy, JobReceipt$1 as JobReceipt, type JobStatus, JsonValue, LightningBackend, type LightningFundingOffer, LightningPayment, LightningTransactionListOptions, LightningTransactionSnapshot, LightningWalletInfo, type LnAddressParts, MESSAGES_DIR, type MeltQuoteInfo, MemoryKVStore, Message, type MessagePollOptions, MessageType, type MnemonicValidationResult, MppxChallenge, MppxCredential, NwcBackend, type NwcConnection, NwcError, type NwcRequestOptions, type NwcTransaction, type OutboundMessage, PAIRINGS_DIR, PRIVKEY_HEX_RE, type PayInvoiceOutcome, type PayInvoiceReconcilingOptions, type PayInvoiceResult, type PayOutcome, type Payment, PaymentRequired, PaymentRequirementsV1, PaymentRequirementsV2, type PendingDrain, type PendingFunding, type PendingMelt, type PendingMint, type PendingMintMintingState, type PendingSubmission, type PendingSubmissionAcceptedUnresolved, type PendingSubmissionContext, type PendingTempoChargeFunding, type PendingX402ExactFunding, type PendingX402Funding, type PersistedOutputData, PersistentCounterSource, type ProviderInfo, type ProviderRef, type ProviderText, type Quote, RAIL_FLAGS, RECEIPTS_FILE, RECENT_SPENDS_CAP, RECOVERY_MNEMONIC_FILE, REQUEST_INTENTS_DIR, ROUTER_FEEDBACK_CLAIM_HEADER, ROUTER_FEEDBACK_CLAIM_TTL_MS, type Rail, type RailAsset, type RailFlag, type ReceiptChecks, ReceiptCredit, type ReceiptInvalidReason, type ReceiptKeypair, type ReceiptParseError, type ReceiptTrustAnchor, type ReceiptVerification, type ReceiptVerifyResult, type RecordDrawFundingResult, type RecordSpendOptions, type RpcSource, SPANS_INSERTED_CHANNEL, STABLECOIN_FUND_RAILS, SUPPORTED_PROTOCOL_VERSION, type SelectError, type SendMessageOptions, type SendMessageResult, type SpanProjectionResult, type SpanRow, type SpanTransport, SpanWriter, type StatusOptions, type StoredCredit, type StoredCreditX402Binding, type StoredDrawFunding, type StoredFundingMenuSnapshot, type StoredImplicitCredit, type StoredReceipt, type StoredSiblingCredit, type StoredX402ChannelConfig, type StoredX402ChannelMetadata, type StreamOptions, type StreamResult, type SubmitOptions, type SwapSendReserve, TEMPO_CHAIN_ID, TEMPO_CHANNELS_FILE, TEMPO_CHARGE_PENDING_STALE_MS, TEMPO_MODERATO_CHAIN_ID, TEMPO_MODERATO_RPC, TEMPO_PATH_USD_MODERATO, TEMPO_SESSION_UPDATED_REASON, type TempoAccount, type TempoChannelAssociation, type TempoChannelController, type TempoChannelDescriptor, type TempoChannelExitResult, type TempoChannelReconcileResult, type TempoChannelStoreContext, type TempoCredentialAccount, type TempoNetwork, type TempoSessionClientResolver, type Transport, type JobReceipt as TransportJobReceipt, type TrustAnchorRead, type V1InfoCapability, type V1InfoResponse, type VerifyJobReceiptArgs, WALLET_FILE, WALLET_VERSION, type WalletCredentialConfig, type WalletInfo, type X402Asset, type X402Balance, type X402BatchPayment, type X402ChannelChainReport, type X402ChannelClient, type X402ChannelReconciliation, type X402ConnectedWallet, type X402CreditFlavour, type X402CreditInstrument, X402EnvValidationError, type X402Network, type X402RefundArgs, type X402RefundOutcome, type X402RepinnedWallet, type X402UnobservedBalanceProvenance, X402Version, type X402VoucherPendingState, X402Wallet, X402_BATCH_CHANNEL_ABI, X402_BATCH_SETTLEMENT_KEY, X402_BATCH_SETTLEMENT_SCHEME, X402_CHANNELS_FILE, X402_DEFAULT_FACILITATOR, X402_EXACT_AUTHORIZATION_TTL_SECONDS, X402_EXACT_SCHEME, X402_NETWORKS, X402_PENDING_STALE_MS, X402_RECEIVER_AUTHORIZER_KEY, X402_REFUSAL_TRANSACTION_DISCOVERY_WINDOW_MS, X402_RPC_URL_KEY, X402_SELF_RELAY_KEY, acknowledgeReplayedX402Payment, acknowledgeX402ChannelOwner, advanceTempoChannelExit, appendBudgetSpend, appendFundingReceipt, appendReceipt, applyImplicitReceiptCredit, applyReceiptCredit, applyRetryToPool, asProviderText, asProviderTextOpt, assertAgentMnemonicReplaceable, assertNoRivalX402Voucher, assertSupportedX402Network, assertTempoSessionChallengeWithinAsk, assertTempoSessionDepositWithinCap, assertTempoSessionVoucherWithinAsk, assertX402ChannelPayer, assertX402RequirementDescribesChannel, attestedDvmIdentity, authenticatedBuilderPubkey, backupSecretFile, bindCashuTokenToSubmissionContext, bindDiagnosticCapabilityAuthority, bindDiagnosticIdentityAuthority, breakdownSince, buildAdminAuthHeader, buildAdminChallenge, builderLockPath, canReplaceExpiredX402Deposit, capFor, cashuSubmissionBindingFingerprint, cashuSubmissionBindingFromContext, checkBudgetForLedger, checkMeltQuoteState, checkReceiptAttestation, clearCreditSelection, clearPendingDrain, clearPendingFunding, clearPendingTempoChargeFunding, clearPendingX402ExactFunding, clearPendingX402Funding, clearRefillRailUnavailable, generateIdentity as cliIdentityStoreGenerateIdentity, computeSmartDenominations, costAnchor, coveringMintsForSpend, createDiagnosticCapabilityAuthority, createMintQuoteRetryState, createMonotonicClock, createNoopLogger, createStdoutLogger, createTempoChannelStore, createTempoCloseCredential, createTempoCreditSession, createTempoSessionPaymentFetch, createX402BatchPayment, currentContext, deleteAgentMnemonic, deriveAgentMasterKeypair, deriveAgentRefundSubkey, deriveAgentRefundSubkeyPubkey, deriveBuilderLockKeypair, deriveBuilderLockPubkey, deriveIdentityFromPrivkey, derivePubkeyFromPrivkey, deriveReceiptKeypair, deriveReceiptSecret, deriveTempoAddress, dvmLocationIdentity, effectiveFundingMint, effectiveMints, ensureAddress, ensureConfigDir, ensureConfigSubdir, ensureProvisionalCredit, entryKind, extendDiagnosticIdentityAuthority, fetchBtcUsdRate, fetchCoinGeckoBtcUsd, fetchCoinGeckoSpot, fetchLnurlPayInvoice, fetchMeltQuote, findX402Channel, forgetCredit, formatStaleness, formatUsd, formatUsdcMicrounits, fundWireAmountMicro, fundingModeForTempoIntent, fundingModeForX402Flavour, generateAgentMnemonic, generateEphemeralReceiptKey, generateX402PrivateKey, getBalance, getBalanceByMint, getInfo, getInputFeesForProofs, getLastKnownBtcRate, getTempoUsdcBalance, getX402Balance, hashedCanonicalDvmId, identitiesFileExists, initLoggers, insertSpanBatch, isAbortError, isCreditFundRail, isCreditFundingMode, isJobIdentityValue, isPublicRequestId, isSignableExactRequirement, isStablecoinFundRail, isStorableJobId, isValidEvmPrivateKey, issueRouterFeedbackClaim, listCredits, listFundingMenuSnapshots, listImplicitCredits, listPendingFundings, listPendingX402Fundings, listPendingX402FundingsForChannel, listResumableTempoChargeFundings, listResumableX402ExactFundings, listResumableX402Fundings, listTempoChannelAssociations, listTransactions, listX402Channels, loadAgentWallet, loadBudgetLedger, loadCredit, loadCreditX402Binding, loadIdentities, loadImplicitCredits, loadPendingFunding, loadReceipt, loadReceipts, loadResumableTempoChargeFunding, loadResumableX402ExactFunding, loadResumableX402Funding, loadTempoChannelAssociation, loadTempoChannelAssociationByKey, loadTempoChannelController, loadTempoChannelEntry, loadWalletConfiguredMints, loggers, looksLikeMnemonic, lookupInvoice, makeInvoice, markCredit, markImplicitCreditLost, markRefillDrainNoticed, markRefillRailUnavailable, maxAdvertisedMicro, maxKeysetDenomination, microToSats, missingDleqRecoveryDiagnostic, mnemonicFingerprint, msatsToMicro, msatsToUsd, msatsToUsdCents, msatsToUsdc, normalizeCreditEndpoint, normalizeFeedbackEndpointHost, nwcDedupWindowMs, nwcTimeoutMs, offersTempoCreditCharge, offersTempoCreditFunding, offersTempoCreditSession, offersX402CreditChannel, offersX402CreditFlavour, offersX402CreditFunding, parseCreditMenu, parseCreditTerms, parseJobIdentityHeader, parseLnAddress, parseNwcUri, parseTraceparent, payInvoiceReconciling, pendingDrainById, pendingDrainFor, persistTempoOpenCredential, pinDimension, prepareP2PKMint, processX402BatchCorrection, processX402BatchResponse, processX402BatchResponseForWallet, projectDiagnosticFields, projectEventName, projectSpanRow, providerProseSources, providerTextToString, randomTraceId, readAgentMnemonic, readCompletedCreditHistory, readFundValuation, readX402ChannelGuardFacts, readX402ChannelOnChain, receiptPubkeyFromSecret, receiveToAgentWallet, reconcileRefusedX402Deposits, reconcileTempoChannelOnChain, recordBalanceResponse, recordCreditX402Instrument, recordDrainReceipts, recordDrawFunding, recordFundResponse, recordFundingMenuSnapshot, recordPendingDrain, recordPendingFunding, recordPendingTempoChargeFunding, recordPendingX402ExactFunding, recordPendingX402Funding, recordRefusedDrawBalance, recordX402ChannelMetadata, redactUrl, redactUrlsInText, refundX402BatchChannel, rehydrateOutputData, repairConfigDirMode, resolveLnurlPayMetadataUrl, resolveRpcHttpTransportOptions, resolveRpcOverride, resolveTempoAsset, resolveTempoNetwork, resolveX402Asset, resolveX402ChannelRpc, restoreProofsFromOutputs, retirePendingX402Funding, retireTempoChannel, retireTempoChannelScope, retryMintQuoteOperation, saveAgentWallet, saveBudgetLedger, saveIdentities, selectProofsForSpend, serializeOutputData, setEmitter, settleDrainEvidence, sha256hex, shellQuoteArg, signDvmRequestData, signRequestData, signedRequestDomain, spendEntry, swapFeeForProofs, swapSendReserve, tempoAccountFromConfig, tempoBalanceCheckHint, tempoChallengeAmountMicro, tempoChannelControlledBy, tempoChargeCredentialSettleable, tempoCredentialAmountMicro, tempoCredentialValidBefore, tempoDescriptorController, tempoSessionAssociationByKey, tempoSessionChallenge, tempoSessionChallengeChannelScope, tempoSessionChallengeMicro, tempoSessionCredentialChannelScope, tempoSessionCredentialCumulativeMicro, tempoSessionCumulativeCapMicro, tempoSessionPriorCumulativeMicro, tempoTokenReference, toAgentProof, toCashuProofs, transportErrorCode, tryResolveTempoAsset, unsignRequestData, usdToMsats, usdcToMsats, validateAgentMnemonic, validateLnAddress, validateX402Env, verifyCanonicalSignedRequest, verifyChallenge, verifyDrainReceiptChain, verifyDrawFundingReceiptChain, verifyFundingReceiptChain, verifyJobReceipt, verifyRouterFeedbackClaim, walletExists, weakestReceiptVerdict, windowEnd, windowStart, withIdentitiesLock, withInitRetry, withNwcPool, withTempoChannelLock, withTraceContext, withWalletLock, withX402ChannelLock, withholdsTempoCreditSession, withinAdvertisedTolerance, writeAgentMnemonic, x402ChannelBalanceUnreconciledAt, x402ChannelControlledBy, x402ChannelReservation, x402CreditChannelNetworks, x402CreditExactNetworks, x402CreditFlavour, x402CreditFundingNetworks, x402ExactFundingDead, x402FlavourForInstrument, x402InstrumentForFlavour, x402NetworkByCaip2, x402NetworkBySlug, x402NetworkLabel, x402NetworkListForCopy, x402PendingBlockExpiresAt, x402PendingDepositExpiresAt, x402PendingFundingJson, x402PendingRetired, x402PendingStale, x402PendingUnsettled, x402RequiredFromError, x402ReservationRelease, x402SupportedNetworksHint, x402VoucherPendingState, x402WalletFromConfig };
|
|
6507
|
+
export { ADMIN_STATE_UNAVAILABLE, AGENT_MNEMONIC_FILE, type AgentProof, type AgentRecentSpend, type AgentWallet, type AttestedDvmIdentity, BTC_RATE_FILE, BUDGET_FILE, type BudgetCaps, type BudgetCheckResult, type BudgetLedger, type BudgetLedgerEntry, type BudgetSpendBreakdown, type BudgetSpendKind, type BudgetWindow, type BuilderLockKeypair, CAPABILITY_NAME_RE, COINGECKO_SIMPLE_PRICE_URL, CONFIG_AUDIT_FILE, CONFIG_BACKUP_FILE, CONFIG_DIR, CONFIG_FILE, CONFIG_PINNED_FILE, CREDITS_FILE, CREDIT_DRAIN_RAILS, CREDIT_FUNDING_MODES, CREDIT_FUND_RAILS, type CachedBtcRate, type CancelOptions, type CliIdentityEntry, type CoinGeckoBtcSpot, type CoinGeckoSpot, type CompletedCreditHistoryPage, type CompletedCreditHistoryQuery, type CompletedCreditHistoryRecord, type CompletedRefundHistoryRecord, type ConfigDirModeResult, CreatedInvoice, type CreditDrainRail, type CreditFundRail, type CreditFundingMode, type CreditMenu, type CreditOpResult, type CreditTerms, type CreditWire, DEFAULT_AGENT_MINT_URL, DIAGNOSTIC_CATALOGUE_VERSION, DbTransport, type DeliveredResult, type DescribeOptions, type DiagnosticCapabilityAuthority, type DiagnosticIdentityAuthority, DrainReceipt, type DrainReceiptChecks, type DrainReceiptVerifyResult, type DrainWire, DrawFundingReceipt, type DrawFundingReceiptChecks, type DrawFundingReceiptVerifyResult, type DrawFundingRejection, DvmError, DvmX402ChannelStorage, type ExpiredCreditLossHistoryRecord, FAVORITES_FILE, FEEDBACK_NUDGES_FILE, type FundValuation, FundingReceipt, type FundingReceiptChecks, type FundingReceiptVerifyResult, IDENTITIES_FILE, IDENTITIES_VERSION, type IdentitiesFile, InvoiceStatus, JOBS_FILE, JOB_IDENTITY_HEADER, type JobEnvelope, type JobIdentityHeaderResult, type JobPolicy, JobReceipt$1 as JobReceipt, type JobStatus, JsonValue, LightningBackend, type LightningFundingOffer, LightningPayment, LightningTransactionListOptions, LightningTransactionSnapshot, LightningWalletInfo, type LnAddressParts, MESSAGES_DIR, type MeltQuoteInfo, MemoryKVStore, Message, type MessagePollOptions, MessageType, type MnemonicValidationResult, MppxChallenge, MppxCredential, NwcBackend, type NwcConnection, NwcError, type NwcRequestOptions, type NwcTransaction, type OutboundMessage, PAIRINGS_DIR, PRIVKEY_HEX_RE, type PayInvoiceOutcome, type PayInvoiceReconcilingOptions, type PayInvoiceResult, type PayOutcome, type Payment, PaymentRequired, PaymentRequirementsV1, PaymentRequirementsV2, type PendingDrain, type PendingFunding, type PendingMelt, type PendingMint, type PendingMintMintingState, type PendingSubmission, type PendingSubmissionAcceptedUnresolved, type PendingSubmissionContext, type PendingTempoChargeFunding, type PendingX402ExactFunding, type PendingX402Funding, type PersistedOutputData, PersistentCounterSource, type ProviderInfo, type ProviderRef, type ProviderText, type Quote, RAIL_FLAGS, RECEIPTS_FILE, RECENT_SPENDS_CAP, RECOVERY_MNEMONIC_FILE, REQUEST_INTENTS_DIR, ROUTER_FEEDBACK_CLAIM_HEADER, ROUTER_FEEDBACK_CLAIM_TTL_MS, type Rail, type RailAsset, type RailFlag, type ReceiptChecks, ReceiptCredit, type ReceiptInvalidReason, type ReceiptKeypair, type ReceiptParseError, type ReceiptTrustAnchor, type ReceiptVerification, type ReceiptVerifyResult, type RecordDrawFundingResult, type RecordSpendOptions, type RpcSource, SPANS_INSERTED_CHANNEL, STABLECOIN_FUND_RAILS, SUPPORTED_PROTOCOL_VERSION, type SelectError, type SendMessageOptions, type SendMessageResult, type SpanProjectionResult, type SpanRow, type SpanTransport, SpanWriter, type StatusOptions, type StoredCredit, type StoredCreditX402Binding, type StoredDrawFunding, type StoredFundingMenuSnapshot, type StoredImplicitCredit, type StoredReceipt, type StoredSiblingCredit, type StoredX402ChannelConfig, type StoredX402ChannelMetadata, type StreamOptions, type StreamResult, type SubmitOptions, type SwapSendReserve, TEMPO_CHAIN_ID, TEMPO_CHANNELS_FILE, TEMPO_CHARGE_PENDING_STALE_MS, TEMPO_MODERATO_CHAIN_ID, TEMPO_MODERATO_RPC, TEMPO_PATH_USD_MODERATO, TEMPO_SESSION_UPDATED_REASON, type TempoAccount, type TempoChannelAssociation, type TempoChannelController, type TempoChannelDescriptor, type TempoChannelExitResult, type TempoChannelReconcileResult, type TempoChannelStoreContext, type TempoCredentialAccount, type TempoNetwork, type TempoSessionClientResolver, type Transport, type JobReceipt as TransportJobReceipt, type TrustAnchorRead, UpfrontPayment, type V1InfoCapability, type V1InfoResponse, type VerifyJobReceiptArgs, WALLET_FILE, WALLET_VERSION, type WalletCredentialConfig, type WalletInfo, type X402Asset, type X402Balance, type X402BatchPayment, type X402ChannelChainReport, type X402ChannelClient, type X402ChannelReconciliation, type X402ConnectedWallet, type X402CreditFlavour, type X402CreditInstrument, X402EnvValidationError, type X402Network, type X402RefundArgs, type X402RefundOutcome, type X402RepinnedWallet, type X402UnobservedBalanceProvenance, X402Version, type X402VoucherPendingState, X402Wallet, X402_BATCH_CHANNEL_ABI, X402_BATCH_SETTLEMENT_KEY, X402_BATCH_SETTLEMENT_SCHEME, X402_CHANNELS_FILE, X402_DEFAULT_FACILITATOR, X402_EXACT_AUTHORIZATION_TTL_SECONDS, X402_EXACT_SCHEME, X402_NETWORKS, X402_PENDING_STALE_MS, X402_RECEIVER_AUTHORIZER_KEY, X402_REFUSAL_TRANSACTION_DISCOVERY_WINDOW_MS, X402_RPC_URL_KEY, X402_SELF_RELAY_KEY, acknowledgeReplayedX402Payment, acknowledgeX402ChannelOwner, advanceTempoChannelExit, appendBudgetSpend, appendFundingReceipt, appendReceipt, applyImplicitReceiptCredit, applyReceiptCredit, applyRetryToPool, asProviderText, asProviderTextOpt, assertAgentMnemonicReplaceable, assertNoRivalX402Voucher, assertSupportedX402Network, assertTempoSessionChallengeWithinAsk, assertTempoSessionDepositWithinCap, assertTempoSessionVoucherWithinAsk, assertX402ChannelPayer, assertX402RequirementDescribesChannel, attestedDvmIdentity, authenticatedBuilderPubkey, backupSecretFile, bindCashuTokenToSubmissionContext, bindDiagnosticCapabilityAuthority, bindDiagnosticIdentityAuthority, breakdownSince, buildAdminAuthHeader, buildAdminChallenge, builderLockPath, canReplaceExpiredX402Deposit, capFor, cashuSubmissionBindingFingerprint, cashuSubmissionBindingFromContext, checkBudgetForLedger, checkMeltQuoteState, checkReceiptAttestation, clearCreditSelection, clearPendingDrain, clearPendingFunding, clearPendingTempoChargeFunding, clearPendingX402ExactFunding, clearPendingX402Funding, clearRefillRailUnavailable, generateIdentity as cliIdentityStoreGenerateIdentity, computeSmartDenominations, costAnchor, coveringMintsForSpend, createDiagnosticCapabilityAuthority, createMintQuoteRetryState, createMonotonicClock, createNoopLogger, createStdoutLogger, createTempoChannelStore, createTempoCloseCredential, createTempoCreditSession, createTempoSessionPaymentFetch, createX402BatchPayment, currentContext, deleteAgentMnemonic, deriveAgentMasterKeypair, deriveAgentRefundSubkey, deriveAgentRefundSubkeyPubkey, deriveBuilderLockKeypair, deriveBuilderLockPubkey, deriveIdentityFromPrivkey, derivePubkeyFromPrivkey, deriveReceiptKeypair, deriveReceiptSecret, deriveTempoAddress, dvmLocationIdentity, effectiveFundingMint, effectiveMints, ensureAddress, ensureConfigDir, ensureConfigSubdir, ensureProvisionalCredit, entryKind, extendDiagnosticIdentityAuthority, fetchBtcUsdRate, fetchCoinGeckoBtcUsd, fetchCoinGeckoSpot, fetchLnurlPayInvoice, fetchMeltQuote, findX402Channel, forgetCredit, formatStaleness, formatUsd, formatUsdcMicrounits, fundWireAmountMicro, fundingModeForTempoIntent, fundingModeForX402Flavour, generateAgentMnemonic, generateEphemeralReceiptKey, generateX402PrivateKey, getBalance, getBalanceByMint, getInfo, getInputFeesForProofs, getLastKnownBtcRate, getTempoUsdcBalance, getX402Balance, hashedCanonicalDvmId, identitiesFileExists, initLoggers, insertSpanBatch, isAbortError, isCreditFundRail, isCreditFundingMode, isJobIdentityValue, isPublicRequestId, isSignableExactRequirement, isStablecoinFundRail, isStorableJobId, isValidEvmPrivateKey, issueRouterFeedbackClaim, listCredits, listFundingMenuSnapshots, listImplicitCredits, listPendingFundings, listPendingX402Fundings, listPendingX402FundingsForChannel, listResumableTempoChargeFundings, listResumableX402ExactFundings, listResumableX402Fundings, listTempoChannelAssociations, listTransactions, listX402Channels, loadAgentWallet, loadBudgetLedger, loadCredit, loadCreditX402Binding, loadIdentities, loadImplicitCredits, loadPendingFunding, loadReceipt, loadReceipts, loadResumableTempoChargeFunding, loadResumableX402ExactFunding, loadResumableX402Funding, loadTempoChannelAssociation, loadTempoChannelAssociationByKey, loadTempoChannelController, loadTempoChannelEntry, loadWalletConfiguredMints, loggers, looksLikeMnemonic, lookupInvoice, makeInvoice, markCredit, markImplicitCreditLost, markRefillDrainNoticed, markRefillRailUnavailable, maxAdvertisedMicro, maxKeysetDenomination, microToSats, missingDleqRecoveryDiagnostic, mnemonicFingerprint, msatsToMicro, msatsToUsd, msatsToUsdCents, msatsToUsdc, normalizeCreditEndpoint, normalizeFeedbackEndpointHost, nwcDedupWindowMs, nwcTimeoutMs, offersTempoCreditCharge, offersTempoCreditFunding, offersTempoCreditSession, offersX402CreditChannel, offersX402CreditFlavour, offersX402CreditFunding, parseCreditMenu, parseCreditTerms, parseJobIdentityHeader, parseLnAddress, parseNwcUri, parseTraceparent, payInvoiceReconciling, pendingDrainById, pendingDrainFor, persistTempoOpenCredential, pinDimension, prepareP2PKMint, processX402BatchCorrection, processX402BatchResponse, processX402BatchResponseForWallet, projectDiagnosticFields, projectEventName, projectSpanRow, providerProseSources, providerTextToString, randomTraceId, readAgentMnemonic, readCompletedCreditHistory, readFundValuation, readX402ChannelGuardFacts, readX402ChannelOnChain, receiptPubkeyFromSecret, receiveToAgentWallet, reconcileRefusedX402Deposits, reconcileTempoChannelOnChain, recordBalanceResponse, recordCreditX402Instrument, recordDrainReceipts, recordDrawFunding, recordFundResponse, recordFundingMenuSnapshot, recordPendingDrain, recordPendingFunding, recordPendingTempoChargeFunding, recordPendingX402ExactFunding, recordPendingX402Funding, recordRefusedDrawBalance, recordX402ChannelMetadata, redactUrl, redactUrlsInText, refundX402BatchChannel, rehydrateOutputData, repairConfigDirMode, resolveLnurlPayMetadataUrl, resolveRpcHttpTransportOptions, resolveRpcOverride, resolveTempoAsset, resolveTempoNetwork, resolveX402Asset, resolveX402ChannelRpc, restoreProofsFromOutputs, retirePendingX402Funding, retireTempoChannel, retireTempoChannelScope, retryMintQuoteOperation, saveAgentWallet, saveBudgetLedger, saveIdentities, selectProofsForSpend, serializeOutputData, setEmitter, settleDrainEvidence, sha256hex, shellQuoteArg, signDvmRequestData, signRequestData, signedRequestDomain, spendEntry, swapFeeForProofs, swapSendReserve, tempoAccountFromConfig, tempoBalanceCheckHint, tempoChallengeAmountMicro, tempoChannelControlledBy, tempoChargeCredentialSettleable, tempoCredentialAmountMicro, tempoCredentialValidBefore, tempoDescriptorController, tempoSessionAssociationByKey, tempoSessionChallenge, tempoSessionChallengeChannelScope, tempoSessionChallengeMicro, tempoSessionCredentialChannelScope, tempoSessionCredentialCumulativeMicro, tempoSessionCumulativeCapMicro, tempoSessionPriorCumulativeMicro, tempoTokenReference, toAgentProof, toCashuProofs, transportErrorCode, tryResolveTempoAsset, unsignRequestData, usdToMsats, usdcToMsats, validateAgentMnemonic, validateLnAddress, validateX402Env, verifyCanonicalSignedRequest, verifyChallenge, verifyDrainReceiptChain, verifyDrawFundingReceiptChain, verifyFundingReceiptChain, verifyJobReceipt, verifyRouterFeedbackClaim, walletExists, weakestReceiptVerdict, windowEnd, windowStart, withIdentitiesLock, withInitRetry, withNwcPool, withTempoChannelLock, withTraceContext, withWalletLock, withX402ChannelLock, withholdsTempoCreditSession, withinAdvertisedTolerance, writeAgentMnemonic, x402ChannelBalanceUnreconciledAt, x402ChannelControlledBy, x402ChannelReservation, x402CreditChannelNetworks, x402CreditExactNetworks, x402CreditFlavour, x402CreditFundingNetworks, x402ExactFundingDead, x402FlavourForInstrument, x402InstrumentForFlavour, x402NetworkByCaip2, x402NetworkBySlug, x402NetworkLabel, x402NetworkListForCopy, x402PendingBlockExpiresAt, x402PendingDepositExpiresAt, x402PendingFundingJson, x402PendingRetired, x402PendingStale, x402PendingUnsettled, x402RequiredFromError, x402ReservationRelease, x402SupportedNetworksHint, x402VoucherPendingState, x402WalletFromConfig };
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { FacilitatorConfig } from '@x402/core/server';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { an as PaymentPayload, ac as PaymentRequirementsV1, ad as PaymentRequirementsV2, aI as X402Config, ay as SettleResponse, aG as VerifyResponse, bp as X402ExactVersionSupport, bq as X402Receipt, br as TransactionalPayoutHook, bs as CashuMeltCompleted } from '../step-cache-BCRHimiY.js';
|
|
3
|
+
export { bt as CreditDepositPayload, bu as CreditDrainPayload, bv as FundingLot, bw as LotDebit, bx as LotDepletion, by as MppxServer, bz as NON_CHANNEL_BITCOIN_RAILS, bA as NonChannelBitcoinRail, bB as PayoutReporter, bC as PostgresTempoSessionStore, bD as RevenueReporter, bE as SIGNED_ENVELOPE_FIELDS, bF as SIGNED_ENVELOPE_TYPES, bG as X402TrackedChannel, bH as _testing, bI as createDefaultReplayStore, bJ as depleteLots, bK as fifoOrder, bL as inKindDrawMsats, bM as isInKindDepletion, bN as isNonChannelBitcoinRail, bO as lotOwedSats, bP as netOwedSats, bQ as wrapMppx } from '../step-cache-BCRHimiY.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
8
|
import { g as getWallet } from '../wallet-Dwjs5n_M.js';
|
|
9
|
-
import { C as ConsumedCredentialStore, L as LockPubkeyStateLoader } from '../credit-menu-
|
|
10
|
-
export { A as AccumulatorPool, a as AppEnv, b as CreditFundingReport, D as DEFAULT_LOCK_PUBKEY_GRACE_SECONDS, F as FiatDenomination, c as FiatDenominationFailure, d as FundOnlyRequest, I as IncomingPaymentOpts, J as JobCancelledError, e as LockPubkeyPool, f as LockPubkeyState, M as MintHealthTracker, P as PAYMENT_PROOF_KEYS, g as PaymentErrorCode, h as PaymentErrorDetail, i as PaymentInfo, j as PostgresTempoChargeStore, R as ReporterBannerOpts, k as ResolvedFx, l as RevenueBootCheckOpts, S as SDKServerOpts, m as ServerJob, n as ShortPayForfeit, T as TempoChannelReport, o as TempoObserverHealth, p as TempoSessionChannelMismatchError, U as UpfrontPaymentOpts, V as VerifiedIncomingPayment, q as VerifyIncomingSnapshot, X as X402BatchChannelObservation, r as X402FacilitatorHealth, s as X402SettlementEvidenceOutcome, t as X402SettlementRepair, u as X402SettlementRepairRefusal, v as X402SettlementRepaired, w as X402WedgedSettlement, x as X402WedgedSettlementPage, y as X402_BATCH_SETTLEMENT_MAINNET_NETWORK, z as abortJob, B as activePubkeySet, E as applyPaymentInfoToJob, G as assertRevenueReporterReady, H as buildPaymentErrorResponse, K as clearAccumulatorForDvm, N as createDVMServer, O as creditDepositPayload, Q as derivedFundCreditId, W as devModeSkipsPaymentVerification, Y as fromJobRecord, Z as fundedMicroFor, _ as hasPaymentProof, $ as hashLockKey, a0 as implicitCreditId, a1 as initLockPubkeyTable, a2 as initWalletAccumulatorTable, a3 as insertAccumulatorRows, a4 as isDerivedCreditId, a5 as isTerminal, a6 as isYieldMessage, a7 as issueUpfrontChallenges, a8 as loadLockPubkeyState, a9 as msatsToFiatMicro, aa as paymentErrorBody, ab as pinAskFiat, ac as priceFiatMicro, ad as processIncomingPayment, ae as providerMessage, af as pruneRetired, ag as repairX402ExactSettlementEffect, ah as resolveFxSnapshot, ai as resolvePriceFiat, aj as revenueReporterBannerState, ak as rotateLockPubkey, al as seedLockPubkeyState, am as toCreditTerms, an as toJobRecord, ao as unknownRouteNotFound, ap as verifyIncomingPayment, aq as verifyTempoSessionManagementCredential, ar as verifyUpfrontPayment, as as x402RequiredUsdcMicro, at as x402SettledShare } from '../credit-menu-
|
|
11
|
-
export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-
|
|
9
|
+
import { C as ConsumedCredentialStore, L as LockPubkeyStateLoader } from '../credit-menu-B239nIY5.js';
|
|
10
|
+
export { A as AccumulatorPool, a as AppEnv, b as CreditFundingReport, D as DEFAULT_LOCK_PUBKEY_GRACE_SECONDS, F as FiatDenomination, c as FiatDenominationFailure, d as FundOnlyRequest, I as IncomingPaymentOpts, J as JobCancelledError, e as LockPubkeyPool, f as LockPubkeyState, M as MintHealthTracker, P as PAYMENT_PROOF_KEYS, g as PaymentErrorCode, h as PaymentErrorDetail, i as PaymentInfo, j as PostgresTempoChargeStore, R as ReporterBannerOpts, k as ResolvedFx, l as RevenueBootCheckOpts, S as SDKServerOpts, m as ServerJob, n as ShortPayForfeit, T as TempoChannelReport, o as TempoObserverHealth, p as TempoSessionChannelMismatchError, U as UpfrontPaymentOpts, V as VerifiedIncomingPayment, q as VerifyIncomingSnapshot, X as X402BatchChannelObservation, r as X402FacilitatorHealth, s as X402SettlementEvidenceOutcome, t as X402SettlementRepair, u as X402SettlementRepairRefusal, v as X402SettlementRepaired, w as X402WedgedSettlement, x as X402WedgedSettlementPage, y as X402_BATCH_SETTLEMENT_MAINNET_NETWORK, z as abortJob, B as activePubkeySet, E as applyPaymentInfoToJob, G as assertRevenueReporterReady, H as buildPaymentErrorResponse, K as clearAccumulatorForDvm, N as createDVMServer, O as creditDepositPayload, Q as derivedFundCreditId, W as devModeSkipsPaymentVerification, Y as fromJobRecord, Z as fundedMicroFor, _ as hasPaymentProof, $ as hashLockKey, a0 as implicitCreditId, a1 as initLockPubkeyTable, a2 as initWalletAccumulatorTable, a3 as insertAccumulatorRows, a4 as isDerivedCreditId, a5 as isTerminal, a6 as isYieldMessage, a7 as issueUpfrontChallenges, a8 as loadLockPubkeyState, a9 as msatsToFiatMicro, aa as paymentErrorBody, ab as pinAskFiat, ac as priceFiatMicro, ad as processIncomingPayment, ae as providerMessage, af as pruneRetired, ag as repairX402ExactSettlementEffect, ah as resolveFxSnapshot, ai as resolvePriceFiat, aj as revenueReporterBannerState, ak as rotateLockPubkey, al as seedLockPubkeyState, am as toCreditTerms, an as toJobRecord, ao as unknownRouteNotFound, ap as verifyIncomingPayment, aq as verifyTempoSessionManagementCredential, ar as verifyUpfrontPayment, as as x402RequiredUsdcMicro, at as x402SettledShare } from '../credit-menu-B239nIY5.js';
|
|
11
|
+
export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-CA7u1nHV.js';
|
|
12
12
|
import { z } from 'zod';
|
|
13
|
-
export { f as LockPubkeyStoreLockPubkey, t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-
|
|
13
|
+
export { f as LockPubkeyStoreLockPubkey, t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-BOcopzXk.js';
|
|
14
14
|
import 'mppx';
|
|
15
15
|
import '@x402/evm/batch-settlement/server';
|
|
16
16
|
import '@x402/core/types';
|
|
17
17
|
import 'viem';
|
|
18
18
|
import '@cashu/cashu-ts';
|
|
19
|
-
import '../fx-
|
|
19
|
+
import '../fx-BmvWGISH.js';
|
|
20
20
|
|
|
21
21
|
declare function verifyWithFacilitator(payload: PaymentPayload, requirements: PaymentRequirementsV1 | PaymentRequirementsV2, config?: Pick<X402Config, "facilitator" | "facilitatorAuth">, createAuthHeaders?: FacilitatorConfig["createAuthHeaders"] | undefined): Promise<VerifyResponse>;
|
|
22
22
|
declare function settleWithFacilitator(payload: PaymentPayload, requirements: PaymentRequirementsV1 | PaymentRequirementsV2, config?: Pick<X402Config, "facilitator" | "facilitatorAuth">, createAuthHeaders?: FacilitatorConfig["createAuthHeaders"] | undefined): Promise<SettleResponse>;
|
package/dist/internal/server.js
CHANGED
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
verifyUpfrontPayment,
|
|
62
62
|
x402RequiredUsdcMicro,
|
|
63
63
|
x402SettledShare
|
|
64
|
-
} from "../chunk-
|
|
64
|
+
} from "../chunk-ZJRGORJ3.js";
|
|
65
65
|
import "../chunk-XRLKGCAW.js";
|
|
66
66
|
import {
|
|
67
67
|
PayoutReporter
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
verifyWithFacilitator
|
|
72
72
|
} from "../chunk-I2H2XYQV.js";
|
|
73
73
|
import "../chunk-33J3NQDZ.js";
|
|
74
|
-
import "../chunk-
|
|
74
|
+
import "../chunk-YMMCRQ2H.js";
|
|
75
75
|
import {
|
|
76
76
|
SIGNED_ENVELOPE_FIELDS,
|
|
77
77
|
SIGNED_ENVELOPE_TYPES,
|
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
import {
|
|
82
82
|
createInstrumentedFetch,
|
|
83
83
|
isStaleJobReapable
|
|
84
|
-
} from "../chunk-
|
|
84
|
+
} from "../chunk-PKLNMMKF.js";
|
|
85
85
|
import {
|
|
86
86
|
JobCancelledError,
|
|
87
87
|
abortJob,
|
|
@@ -90,7 +90,7 @@ import {
|
|
|
90
90
|
isYieldMessage,
|
|
91
91
|
providerMessage,
|
|
92
92
|
toJobRecord
|
|
93
|
-
} from "../chunk-
|
|
93
|
+
} from "../chunk-KVKJ7R5V.js";
|
|
94
94
|
import {
|
|
95
95
|
toLockPubkey
|
|
96
96
|
} from "../chunk-LZFZGY7L.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { a7 as Message, O as UpfrontPayment, al as FundingMethod, a1 as FundingReceipt, bX as CreditSnapshot, a2 as JobReceipt, aA as StepRecord, a3 as MessageType } from './step-cache-BCRHimiY.js';
|
|
1
2
|
import { ProofLike } from '@cashu/cashu-ts';
|
|
2
|
-
import { a6 as Message, ak as FundingMethod, a0 as FundingReceipt, bW as CreditSnapshot, a1 as JobReceipt, az as StepRecord, a2 as MessageType } from './step-cache-MA3hpa7F.js';
|
|
3
3
|
|
|
4
4
|
type JobStatus = "processing" | "completed" | "failed" | "awaiting-input" | "cancelled" | "working";
|
|
5
5
|
interface JobRecord {
|
|
@@ -69,6 +69,8 @@ interface JobRecord {
|
|
|
69
69
|
summary?: string;
|
|
70
70
|
messages: Message[];
|
|
71
71
|
seq: number;
|
|
72
|
+
/** Original acceptance snapshot; absent for historical records. INSERT-only. */
|
|
73
|
+
upfrontPayment?: UpfrontPayment;
|
|
72
74
|
paidMsats: number;
|
|
73
75
|
paymentMint?: string;
|
|
74
76
|
/** Rail of the most recent successful credit (cashu / x402 / tempo). */
|
|
@@ -510,8 +512,14 @@ interface StreamableJobStore extends JobStore {
|
|
|
510
512
|
* re-read counters when cross-machine credit lands.
|
|
511
513
|
*/
|
|
512
514
|
subscribeNotifications(jobId: string, onNotify: () => void): Promise<() => void>;
|
|
513
|
-
/**
|
|
514
|
-
|
|
515
|
+
/**
|
|
516
|
+
* Read verified history without advancing past a pending payment. Terminal
|
|
517
|
+
* output releases the cutoff. Snapshot reconstruction uses includeHeld to
|
|
518
|
+
* retain every verified message, independently of incremental delivery.
|
|
519
|
+
*/
|
|
520
|
+
getMessages(jobId: string, afterSeq: number, options?: {
|
|
521
|
+
includeHeld?: boolean;
|
|
522
|
+
}): Promise<Message[]>;
|
|
515
523
|
/**
|
|
516
524
|
* Find stale non-terminal jobs. Two status-aware
|
|
517
525
|
* cutoffs (both Unix ms): `processing`/`working` rows older than
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { ag as CashuMode, bR as CreditLedgerQuerier, bS as CreditDrainEnqueue, bT as HostedSettlementReportObligations, R as ResolvedCreditConfig, bU as DVMAuthScheme, B as SignedRequestDomain, bV as CreditLedgerLike, bW as X402RefundSettlementGate, bX as CreditSnapshot, bY as CreditDrawRefundArgs, bZ as CreditDrawRefundResult, b_ as DrawResult, b$ as X402SettlementStatus, c0 as X402UnresolvedRefund, c1 as GrownDrawResult, c2 as DrawResolution, c3 as FundingRecord, c4 as CreditFundingEvidence, c5 as CreditInvoiceRecord, c6 as InvoiceSettlement, c7 as BlockedInvoiceCursor, c8 as InvoiceReconciliation, c9 as InvoiceWriteOff, ca as DrawRecord, cb as StalePendingDrawCursor, cc as TempoCreditLossEvidence, cd as TempoCreditLoss, ce as X402CreditLossEvidence, cf as X402CreditLoss, cg as DrainMethod, ch as DrainRequestResult, ci as BitcoinDepositLiability, bv as FundingLot, cj as CreditDrainRecord, ck as ChannelDrainCursor, cl as DrainWriteOff, cm as DrainTransitionResult, cn as DrainReleaseResult, co as DrainFulfilment, cp as HostingCleanupFence, aA as StepRecord, a2 as JobReceipt, a7 as Message, K as KVStore, G as SignedRequestReplayStore, Z as ZodLike, a as DVMDescriptor } from '../step-cache-BCRHimiY.js';
|
|
2
|
+
export { cq as CLIENT_COMPATIBILITY_HEADERS, d as CanonicalEnvelope, cr as ClientCompatibility, cs as ClientCompatibilityEnv, ct as ClientCompatibilityGate, cu as ClientCompatibilityRequirement, cv as ClientSemVer, f as CreateSignedRequestVerifierOpts, cw as CreditFundingBasis, cx as CreditInvoiceStatus, cy as CreditLedger, cz as CreditLedgerError, cA as CreditLedgerErrorCode, cB as CreditLedgerErrorDetails, cC as CreditLedgerPool, cD as CreditStatus, cE as DRAIN_DELIVERY_RESERVE_SATS, cF as DVM_PROTOCOL_VERSION, cG as DrainConflictReason, cH as DrawRailValue, cI as DrawStatus, cJ as HostedTempoCloseReportWriteOff, cK as JobCostReportPayload, cL as JobTerminalReportPayload, cM as PostgresX402ChannelStorage, cN as ReplayStoreBackend, cO as RevenueSkippedNoRailPayload, cP as RevenueSkippedNoRailReason, x as SIGNED_REQUEST_AUTH_ID, y as SIGNED_REQUEST_STATEMENT_VERSION, cQ as Secp256k1AuthOpts, z as SignedRequestAudience, E as SignedRequestError, F as SignedRequestFailure, H as SignedRequestSignOpts, M as SignedRequestStatementHeader, N as SignedRequestVerifier, cR as TempoDrainDecision, cS as TempoDrainDecisionArgs, cT as TempoDrainDecisionResult, cU as TempoDrainHoldReason, O as UpfrontPayment, cV as X402ChannelStorageOpts, cW as X402RelayLockHolder, cX as X402RelaySubmissionLock, cY as X402RelaySubmissionLockError, cZ as allocateDrawValue, c_ as clientCompatibilityAttributes, c$ as clientCompatibilityMiddleware, d0 as clientUpgradeRequired, T as createSignedRequestVerifier, d1 as parseClientCapabilities, d2 as parseClientCompatibility, d3 as parseDvmClient, d4 as parseProtocolVersion, d5 as requireClientCompatibility, d6 as retryHostedTempoCloseReport, d7 as secp256k1Auth, d8 as signedRequestInput, W as signedRequestStatementHeader, d9 as writeOffHostedTempoCloseReport } from '../step-cache-BCRHimiY.js';
|
|
3
3
|
import { Pool } from 'pg';
|
|
4
|
-
import { au as CreditMenu, a as AppEnv, U as UpfrontPaymentOpts, i as PaymentInfo, av as ReceiptIssuer, aw as LightningReceive, ax as TempoSettlementReadiness, ay as DVMHostOpts, az as DVMServeResult, L as LockPubkeyStateLoader, C as ConsumedCredentialStore } from '../credit-menu-
|
|
5
|
-
export { aA as BuildCreditMenuArgs, aB as BuilderIdentity, aC as CREDIT_ENVELOPE_KEYS, aD as CreateX402BatchSettlementServerOpts, aE as CreditEnvelope, aF as CreditEnvelopeError, aG as CreditFundCommitment, aH as CreditTerms, aI as DEFAULT_INVOICE_TTL_SECONDS, aJ as DVMHost, aK as HostingClosureCommand, aL as HostingClosureEvidence, aM as HostingControlCommand, aN as HostingControlConfig, aO as HostingControlStatus, aP as JobManager, aQ as JobManagerOpts, aR as LightningReceiveConfig, aS as MIN_INVOICE_TTL_SECONDS, aT as MemoryConsumedCredentialStore, aU as MemoryConsumedCredentialStoreOpts, aV as MemoryProcessedPaymentStore, aW as MemoryX402ExactSettlementStore, aX as MountOpts, aY as OwnerDisplay, aZ as PaidJobCompletion, a_ as PaymentMode, a$ as PlatformReporterOpts, b0 as PostgresProcessedPaymentStore, b1 as PostgresX402ExactSettlementStore, b2 as PriceFiat, b3 as ProcessedPaymentQuerier, b4 as ProcessedPaymentRail, b5 as ProcessedPaymentRecord, b6 as ProcessedPaymentReplayError, b7 as ProcessedPaymentStore, b8 as X402BatchAcceptance, b9 as X402BatchFunding, ba as X402BatchRefusal, bb as X402BatchSettlementServer, bc as X402ExactAcceptance, bd as X402ExactIntentConflictError, be as X402ExactSettlementAttempt, bf as X402ExactSettlementChainEvidence, bg as X402ExactSettlementEffect, bh as X402ExactSettlementEvidenceMissingError, bi as X402ExactSettlementEvidenceReader, bj as X402ExactSettlementIntent, bk as X402ExactSettlementNotReadyError, bl as X402ExactSettlementServer, bm as X402ExactSettlementServerOpts, bn as X402ExactSettlementStatus, bo as X402ExactSettlementStore, bp as X402SettlementChainEvidence, bq as X402SettlementEvidenceReader, br as X402SettlementSubmissionError, bs as X402_BATCH_AUTO_SETTLEMENT, bt as X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS, bu as X402_BATCH_SETTLEMENT_NETWORK, bv as attachCreditMenu, bw as buildCreditMenu, bx as createDVMHost, by as createX402BatchSettlementServer, bz as creditEnvelopeIgnoreFields, bA as drawSettlementRef, bB as extractCreditEnvelope, bC as fundingCommitment, bD as selectPrimaryCredit, bE as signHostingClosure, bF as signHostingControl, bG as stripCreditEnvelope, bH as toCreditView } from '../credit-menu-
|
|
4
|
+
import { au as CreditMenu, a as AppEnv, U as UpfrontPaymentOpts, i as PaymentInfo, av as ReceiptIssuer, aw as LightningReceive, ax as TempoSettlementReadiness, ay as DVMHostOpts, az as DVMServeResult, L as LockPubkeyStateLoader, C as ConsumedCredentialStore } from '../credit-menu-B239nIY5.js';
|
|
5
|
+
export { aA as BuildCreditMenuArgs, aB as BuilderIdentity, aC as CREDIT_ENVELOPE_KEYS, aD as CreateX402BatchSettlementServerOpts, aE as CreditEnvelope, aF as CreditEnvelopeError, aG as CreditFundCommitment, aH as CreditTerms, aI as DEFAULT_INVOICE_TTL_SECONDS, aJ as DVMHost, aK as HostingClosureCommand, aL as HostingClosureEvidence, aM as HostingControlCommand, aN as HostingControlConfig, aO as HostingControlStatus, aP as JobManager, aQ as JobManagerOpts, aR as LightningReceiveConfig, aS as MIN_INVOICE_TTL_SECONDS, aT as MemoryConsumedCredentialStore, aU as MemoryConsumedCredentialStoreOpts, aV as MemoryProcessedPaymentStore, aW as MemoryX402ExactSettlementStore, aX as MountOpts, aY as OwnerDisplay, aZ as PaidJobCompletion, a_ as PaymentMode, a$ as PlatformReporterOpts, b0 as PostgresProcessedPaymentStore, b1 as PostgresX402ExactSettlementStore, b2 as PriceFiat, b3 as ProcessedPaymentQuerier, b4 as ProcessedPaymentRail, b5 as ProcessedPaymentRecord, b6 as ProcessedPaymentReplayError, b7 as ProcessedPaymentStore, b8 as X402BatchAcceptance, b9 as X402BatchFunding, ba as X402BatchRefusal, bb as X402BatchSettlementServer, bc as X402ExactAcceptance, bd as X402ExactIntentConflictError, be as X402ExactSettlementAttempt, bf as X402ExactSettlementChainEvidence, bg as X402ExactSettlementEffect, bh as X402ExactSettlementEvidenceMissingError, bi as X402ExactSettlementEvidenceReader, bj as X402ExactSettlementIntent, bk as X402ExactSettlementNotReadyError, bl as X402ExactSettlementServer, bm as X402ExactSettlementServerOpts, bn as X402ExactSettlementStatus, bo as X402ExactSettlementStore, bp as X402SettlementChainEvidence, bq as X402SettlementEvidenceReader, br as X402SettlementSubmissionError, bs as X402_BATCH_AUTO_SETTLEMENT, bt as X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS, bu as X402_BATCH_SETTLEMENT_NETWORK, bv as attachCreditMenu, bw as buildCreditMenu, bx as createDVMHost, by as createX402BatchSettlementServer, bz as creditEnvelopeIgnoreFields, bA as drawSettlementRef, bB as extractCreditEnvelope, bC as fundingCommitment, bD as selectPrimaryCredit, bE as signHostingClosure, bF as signHostingControl, bG as stripCreditEnvelope, bH as toCreditView } from '../credit-menu-B239nIY5.js';
|
|
6
6
|
import { Context, Hono } from 'hono';
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
-
import { F as FxFetcher } from '../fx-
|
|
9
|
-
import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters, b as JobStore } from '../job-store-
|
|
10
|
-
export { a as JobStatus, h as isStreamableJobStore } from '../job-store-
|
|
11
|
-
import { C as ContentHoldHistory, a as ContentHoldMutation } from '../content-retention-
|
|
12
|
-
export { b as ContentHold, c as ContentHoldError, d as ContentHoldEvent, e as ContentHoldStore, f as ContentHoldsResponse, J as JobContentMetadata, g as baselineContentExpiry, h as contentMetadata, i as isContentHoldStore } from '../content-retention-
|
|
8
|
+
import { F as FxFetcher } from '../fx-BmvWGISH.js';
|
|
9
|
+
import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters, b as JobStore } from '../job-store-CA7u1nHV.js';
|
|
10
|
+
export { a as JobStatus, h as isStreamableJobStore } from '../job-store-CA7u1nHV.js';
|
|
11
|
+
import { C as ContentHoldHistory, a as ContentHoldMutation } from '../content-retention-BASsjgKw.js';
|
|
12
|
+
export { b as ContentHold, c as ContentHoldError, d as ContentHoldEvent, e as ContentHoldStore, f as ContentHoldsResponse, J as JobContentMetadata, g as baselineContentExpiry, h as contentMetadata, i as isContentHoldStore } from '../content-retention-BASsjgKw.js';
|
|
13
13
|
export { P as PinnedFetch, S as SSRFError, a as SSRFGuardOpts, b as SSRFReason, c as SSRFResolver, d as assertSafeUrl, e as createPinnedFetch } from '../ssrf-dMooihtY.js';
|
|
14
14
|
import { Env, BlankSchema } from 'hono/types';
|
|
15
15
|
import 'mppx';
|
|
@@ -17,7 +17,7 @@ import '@x402/core/server';
|
|
|
17
17
|
import '@x402/evm/batch-settlement/server';
|
|
18
18
|
import '@x402/core/types';
|
|
19
19
|
import 'viem';
|
|
20
|
-
import '../lightning-backend-
|
|
20
|
+
import '../lightning-backend-BOcopzXk.js';
|
|
21
21
|
import '@cashu/cashu-ts';
|
|
22
22
|
|
|
23
23
|
/** Default lifetime of a per-call implicit credit: 90 days before the ledger refuses new draws. */
|
|
@@ -100,8 +100,8 @@ declare const CREDIT_REQUEST_SCHEMA: z.ZodObject<{
|
|
|
100
100
|
fund_id: z.ZodString;
|
|
101
101
|
commitment: z.ZodOptional<z.ZodString>;
|
|
102
102
|
method: z.ZodOptional<z.ZodEnum<{
|
|
103
|
-
lightning: "lightning";
|
|
104
103
|
tempo: "tempo";
|
|
104
|
+
lightning: "lightning";
|
|
105
105
|
}>>;
|
|
106
106
|
intent: z.ZodOptional<z.ZodEnum<{
|
|
107
107
|
charge: "charge";
|
|
@@ -483,7 +483,9 @@ declare class PostgresJobStore implements StreamableJobStore, ReceiptIssuingStor
|
|
|
483
483
|
}>;
|
|
484
484
|
subscribeMessages(jobId: string, afterSeq: number, onMessage: (msg: Message) => void): Promise<() => void>;
|
|
485
485
|
subscribeNotifications(jobId: string, onNotify: () => void): Promise<() => void>;
|
|
486
|
-
getMessages(jobId: string, afterSeq: number
|
|
486
|
+
getMessages(jobId: string, afterSeq: number, options?: {
|
|
487
|
+
includeHeld?: boolean;
|
|
488
|
+
}): Promise<Message[]>;
|
|
487
489
|
initStreaming(): Promise<void>;
|
|
488
490
|
shutdownStreaming(): Promise<void>;
|
|
489
491
|
private dispatch;
|
package/dist/server/index.js
CHANGED
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
toCreditView,
|
|
83
83
|
unknownRouteNotFound,
|
|
84
84
|
writeOffHostedTempoCloseReport
|
|
85
|
-
} from "../chunk-
|
|
85
|
+
} from "../chunk-ZJRGORJ3.js";
|
|
86
86
|
import {
|
|
87
87
|
MemoryProcessedPaymentStore,
|
|
88
88
|
PostgresProcessedPaymentStore,
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
} from "../chunk-33J3NQDZ.js";
|
|
96
96
|
import {
|
|
97
97
|
PostgresJobStore
|
|
98
|
-
} from "../chunk-
|
|
98
|
+
} from "../chunk-YMMCRQ2H.js";
|
|
99
99
|
import {
|
|
100
100
|
SignedRequestError,
|
|
101
101
|
createDefaultReplayStore,
|
|
@@ -104,13 +104,13 @@ import {
|
|
|
104
104
|
} from "../chunk-ZO2ZAPG3.js";
|
|
105
105
|
import {
|
|
106
106
|
isStreamableJobStore
|
|
107
|
-
} from "../chunk-
|
|
107
|
+
} from "../chunk-PKLNMMKF.js";
|
|
108
108
|
import {
|
|
109
109
|
ContentHoldError,
|
|
110
110
|
baselineContentExpiry,
|
|
111
111
|
contentMetadata,
|
|
112
112
|
isContentHoldStore
|
|
113
|
-
} from "../chunk-
|
|
113
|
+
} from "../chunk-KVKJ7R5V.js";
|
|
114
114
|
import {
|
|
115
115
|
IMPLICIT_CREDIT_TTL_MS,
|
|
116
116
|
generateEphemeralReceiptKey,
|
|
@@ -1190,7 +1190,7 @@ function createDVMHost(opts = {}) {
|
|
|
1190
1190
|
});
|
|
1191
1191
|
applyRetryToPool(pool, "dvm-host");
|
|
1192
1192
|
pgPool = pool;
|
|
1193
|
-
const { PostgresJobStore: PostgresJobStore2 } = await import("../postgres-job-store-
|
|
1193
|
+
const { PostgresJobStore: PostgresJobStore2 } = await import("../postgres-job-store-IXTNWT4K.js");
|
|
1194
1194
|
const pgJobStore = new PostgresJobStore2(pool);
|
|
1195
1195
|
pendingInits.push(pgJobStore.init(), pgJobStore.initStreaming());
|
|
1196
1196
|
jobStore = pgJobStore;
|
|
@@ -7,6 +7,28 @@ import { PaymentPayload as PaymentPayload$1, PaymentRequirements as PaymentRequi
|
|
|
7
7
|
import { Account, Client, Hex } from 'viem';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Original accepted job payment, fixed before handler execution. Snake_case is
|
|
12
|
+
* the wire shape. Absence means unknown, while `amount_msats: 0` is known zero.
|
|
13
|
+
* A credit-backed payment describes a pending hold at acceptance, not fresh
|
|
14
|
+
* funding or final settlement: completion settles it, failure/cancellation
|
|
15
|
+
* releases it. Later draw growth and settlement repricing do not change this fact.
|
|
16
|
+
*/
|
|
17
|
+
interface UpfrontPayment {
|
|
18
|
+
amount_msats: number;
|
|
19
|
+
/** Exact accepted draw in millionths of `currency`, when recorded. */
|
|
20
|
+
amount_micro?: number;
|
|
21
|
+
currency?: string;
|
|
22
|
+
/** Funding rail for a credit hold, or the accepted per-call rail. */
|
|
23
|
+
rail?: "cashu" | "x402" | "tempo" | "lightning";
|
|
24
|
+
/** Allocated rail-native atomic units, distinct from credit denomination. */
|
|
25
|
+
native_amount?: number;
|
|
26
|
+
native_asset?: string;
|
|
27
|
+
/** Together these identify credit consumption; neither is a spending credential. */
|
|
28
|
+
credit_id?: string;
|
|
29
|
+
draw_id?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
10
32
|
/** Auth identifier advertised by DVMs using audience-bound caller proofs. */
|
|
11
33
|
declare const SIGNED_REQUEST_AUTH_ID: "secp256k1-schnorr-v2";
|
|
12
34
|
/** Version of the canonical audience-bound caller statement. */
|
|
@@ -6302,4 +6324,4 @@ declare class StepCache {
|
|
|
6302
6324
|
static deserialize(records: StepRecord[]): StepCache;
|
|
6303
6325
|
}
|
|
6304
6326
|
|
|
6305
|
-
export {
|
|
6327
|
+
export { X402_EXACT_SCHEME 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 JobCost as J, type KVStore as K, type Logger as L, type SignedRequestStatementHeader as M, type SignedRequestVerifier as N, type UpfrontPayment as O, type PaymentContent as P, type QuoteConfig as Q, type ResolvedCreditConfig as R, type SDKJobContext as S, createSignedRequestVerifier as T, UnsupportedCurrencyError as U, isZodSchema as V, signedRequestStatementHeader as W, validateCurrency as X, type JsonValue as Y, type ZodLike as Z, X402_BATCH_SETTLEMENT_SCHEME as _, type DVMDescriptor as a, exactEvmAuthorization as a$, type DrawFundingReceipt as a0, type FundingReceipt as a1, type JobReceipt as a2, type MessageType as a3, type X402Version as a4, type MppxCredential as a5, type PaymentRequired as a6, type Message as a7, type MppxChallenge as a8, type ReceiptCredit as a9, type StepRecord as aA, type TextContent as aB, type UnsignedDrainReceipt as aC, type UnsignedDrawFundingReceipt as aD, type UnsignedFundingReceipt as aE, type UnsignedJobReceipt as aF, type VerifyResponse as aG, type WorkingContent as aH, type X402Config$1 as aI, type X402ResponseBody as aJ, type X402SelfRelayRpcFailureReason as aK, X402_DEFAULT_NETWORK as aL, X402_V1_VERSION as aM, X402_VERSION as aN, buildPaymentRequiredV2 as aO, buildPaymentRequirements as aP, caip2ToX402Network as aQ, canonicalRequestPath as aR, canonicaliseForSigning as aS, canonicalize as aT, chainIdFromCaip2 as aU, computeResultHash as aV, decodePayment as aW, decodePaymentRequiredHeader as aX, encodePayment as aY, encodePaymentRequiredHeader as aZ, encodeSettleResponseHeader as a_, type DrainReceipt as aa, type X402Wallet as ab, type PaymentRequirementsV1 as ac, type PaymentRequirementsV2 as ad, type BuildPaymentRequirementsOpts as ae, type CapabilityDescriptor as af, type CashuMode as ag, type CompleteContent as ah, type DrainReceiptEvent as ai, type ExactEvmPayload as aj, type ExactEvmPayloadAuthorization as ak, type FundingMethod as al, type MessageFrom as am, type PaymentPayload as an, type PaymentPayloadV1 as ao, type PaymentPayloadV2 as ap, type PaymentRequestContent as aq, type PaymentRequiredV2 as ar, type PaymentRequirements as as, type PromptContent as at, RAIL_REFUNDABLE as au, type ReceiptOutcome as av, type ReceiptPayment as aw, type ResourceInfo as ax, type SettleResponse as ay, StepCache as az, type ArtifactContent as b, type X402SettlementStatus as b$, isArtifactMessage as b0, isCancelMessage as b1, isCompleteMessage as b2, isDrainReceipt as b3, isDrawFundingReceipt as b4, isFundingReceipt as b5, isPaymentRequestMessage as b6, isPromptMessage as b7, isSignedJobReceipt as b8, isTextMessage as b9, type NonChannelBitcoinRail as bA, PayoutReporter as bB, PostgresTempoSessionStore as bC, RevenueReporter as bD, SIGNED_ENVELOPE_FIELDS as bE, SIGNED_ENVELOPE_TYPES as bF, type X402TrackedChannel as bG, _testing as bH, createDefaultReplayStore as bI, depleteLots as bJ, fifoOrder as bK, inKindDrawMsats as bL, isInKindDepletion as bM, isNonChannelBitcoinRail as bN, lotOwedSats as bO, netOwedSats as bP, wrapMppx as bQ, type CreditLedgerQuerier as bR, type CreditDrainEnqueue as bS, HostedSettlementReportObligations as bT, type DVMAuthScheme as bU, type CreditLedgerLike as bV, type X402RefundSettlementGate as bW, type CreditSnapshot as bX, type CreditDrawRefundArgs as bY, type CreditDrawRefundResult as bZ, type DrawResult as b_, isWorkingMessage as ba, paymentRequiredV2FromV1 as bb, signDrainReceipt as bc, signDrawFundingReceipt as bd, signFundingReceipt as be, signReceipt as bf, usdcContractByCaip2 as bg, usdcContractFor as bh, usdcDomainNameFor as bi, usdcDomainVersionFor as bj, verifyDrainReceipt as bk, verifyDrawFundingReceipt as bl, verifyFundingReceipt as bm, verifyReceipt as bn, x402NetworkToCaip2 as bo, type X402ExactVersionSupport as bp, type X402Receipt as bq, type TransactionalPayoutHook as br, type CashuMeltCompleted as bs, type CreditDepositPayload as bt, type CreditDrainPayload as bu, type FundingLot as bv, type LotDebit as bw, type LotDepletion as bx, type MppxServer as by, NON_CHANNEL_BITCOIN_RAILS as bz, type CancelContent as c, clientCompatibilityMiddleware as c$, type X402UnresolvedRefund as c0, type GrownDrawResult as c1, type DrawResolution as c2, type FundingRecord as c3, type CreditFundingEvidence as c4, type CreditInvoiceRecord as c5, type InvoiceSettlement as c6, type BlockedInvoiceCursor as c7, type InvoiceReconciliation as c8, type InvoiceWriteOff as c9, type CreditLedgerErrorCode as cA, type CreditLedgerErrorDetails as cB, type CreditLedgerPool as cC, type CreditStatus as cD, DRAIN_DELIVERY_RESERVE_SATS as cE, DVM_PROTOCOL_VERSION as cF, type DrainConflictReason as cG, type DrawRailValue as cH, type DrawStatus as cI, type HostedTempoCloseReportWriteOff as cJ, type JobCostReportPayload as cK, type JobTerminalReportPayload as cL, PostgresX402ChannelStorage as cM, type ReplayStoreBackend as cN, type RevenueSkippedNoRailPayload as cO, type RevenueSkippedNoRailReason as cP, type Secp256k1AuthOpts as cQ, type TempoDrainDecision as cR, type TempoDrainDecisionArgs as cS, type TempoDrainDecisionResult as cT, type TempoDrainHoldReason as cU, type X402ChannelStorageOpts as cV, type X402RelayLockHolder as cW, type X402RelaySubmissionLock as cX, X402RelaySubmissionLockError as cY, allocateDrawValue as cZ, clientCompatibilityAttributes as c_, type DrawRecord as ca, type StalePendingDrawCursor as cb, type TempoCreditLossEvidence as cc, type TempoCreditLoss as cd, type X402CreditLossEvidence as ce, type X402CreditLoss as cf, type DrainMethod as cg, type DrainRequestResult as ch, type BitcoinDepositLiability as ci, type CreditDrainRecord as cj, type ChannelDrainCursor as ck, type DrainWriteOff as cl, type DrainTransitionResult as cm, type DrainReleaseResult as cn, type DrainFulfilment as co, HostingCleanupFence as cp, CLIENT_COMPATIBILITY_HEADERS as cq, type ClientCompatibility as cr, type ClientCompatibilityEnv as cs, type ClientCompatibilityGate as ct, type ClientCompatibilityRequirement as cu, type ClientSemVer as cv, type CreditFundingBasis as cw, type CreditInvoiceStatus as cx, CreditLedger as cy, CreditLedgerError as cz, type CanonicalEnvelope as d, clientUpgradeRequired as d0, parseClientCapabilities as d1, parseClientCompatibility as d2, parseDvmClient as d3, parseProtocolVersion as d4, requireClientCompatibility as d5, retryHostedTempoCloseReport as d6, secp256k1Auth as d7, signedRequestInput as d8, writeOffHostedTempoCloseReport as d9, type HostedIntent as da, type X402SettlementIntent as db, type HostedFundingReservation as dc, type X402SettlementCursor as dd, type X402SettlementWriteOff as de, type X402FacilitatorAuth as df, type X402BatchSettlementConfig as dg, type X402PayoutObserver as dh, type CreditDepositEnqueue as di, type X402SettlementReconciliationReason as dj, type CreditDrawReleaseEnqueue as dk, type CapabilityRate as e, type CreateSignedRequestVerifierOpts as f, type CreditConfig as g, type CreditView as h, DEFAULT_CREDIT_MAX as i, DEFAULT_CREDIT_MIN as j, DEFAULT_CREDIT_TTL_SECONDS as k, DEFAULT_JOB_RETENTION_DAYS as l, type DVMRouteContext as m, type InputType as n, InvalidCurrencyError 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/testing/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as ContentHoldHistory, a as ContentHoldMutation } from '../content-retention-
|
|
2
|
-
import {
|
|
3
|
-
import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters } from '../job-store-
|
|
1
|
+
import { C as ContentHoldHistory, a as ContentHoldMutation } from '../content-retention-BASsjgKw.js';
|
|
2
|
+
import { a2 as JobReceipt, a7 as Message, a3 as MessageType, K as KVStore, L as Logger, v as ResponseContent, P as PaymentContent, S as SDKJobContext } from '../step-cache-BCRHimiY.js';
|
|
3
|
+
import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters } from '../job-store-CA7u1nHV.js';
|
|
4
4
|
import 'hono';
|
|
5
5
|
import 'mppx';
|
|
6
6
|
import '@x402/core/server';
|
|
@@ -72,7 +72,9 @@ declare class MemoryJobStore implements StreamableJobStore, ReceiptIssuingStore
|
|
|
72
72
|
}>;
|
|
73
73
|
subscribeMessages(jobId: string, afterSeq: number, onMessage: (msg: Message) => void): Promise<() => void>;
|
|
74
74
|
subscribeNotifications(jobId: string, onNotify: () => void): Promise<() => void>;
|
|
75
|
-
getMessages(jobId: string, afterSeq: number
|
|
75
|
+
getMessages(jobId: string, afterSeq: number, options?: {
|
|
76
|
+
includeHeld?: boolean;
|
|
77
|
+
}): Promise<Message[]>;
|
|
76
78
|
initStreaming(): Promise<void>;
|
|
77
79
|
shutdownStreaming(): Promise<void>;
|
|
78
80
|
/**
|
|
@@ -84,6 +86,7 @@ declare class MemoryJobStore implements StreamableJobStore, ReceiptIssuingStore
|
|
|
84
86
|
private terminateJob;
|
|
85
87
|
private allocateSeq;
|
|
86
88
|
private messagesFor;
|
|
89
|
+
private visibleMessages;
|
|
87
90
|
private notify;
|
|
88
91
|
private fireNotifyOnly;
|
|
89
92
|
}
|
package/dist/testing/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
MemoryJobStore,
|
|
6
6
|
createInstrumentedFetch
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-PKLNMMKF.js";
|
|
8
8
|
import {
|
|
9
9
|
JobCancelledError
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-KVKJ7R5V.js";
|
|
11
11
|
import {
|
|
12
12
|
createNoopLogger
|
|
13
13
|
} from "../chunk-7NZRJPEP.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dvmkit/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "SDK for building Digital Vending Machines: pay-per-use HTTPS services AI agents can find, pay, and call with no account or API key",
|
|
5
5
|
"author": "DVM Technologies Ltd",
|
|
6
6
|
"keywords": [
|