@dvmkit/sdk 0.3.0-rc.9 → 0.3.1-rc.10
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-LTAIBLS2.js → chunk-CC3UY6OS.js} +146 -35
- package/dist/{credit-menu-BlCL7gZx.d.ts → credit-menu-0-UtJ3hh.d.ts} +5 -1
- package/dist/internal/caller.d.ts +7 -1
- package/dist/internal/caller.js +37 -7
- package/dist/internal/server.d.ts +2 -2
- package/dist/internal/server.js +1 -1
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +1 -1
- package/package.json +2 -2
|
@@ -9089,7 +9089,17 @@ function safeError(err) {
|
|
|
9089
9089
|
// src/sdk/server/hosting-control.ts
|
|
9090
9090
|
import { createHmac, timingSafeEqual } from "crypto";
|
|
9091
9091
|
function signHostingControl(secret, command) {
|
|
9092
|
-
|
|
9092
|
+
const signed = command.version === 2 ? [
|
|
9093
|
+
"dvmkit-hosting-v2",
|
|
9094
|
+
command.action,
|
|
9095
|
+
command.scope,
|
|
9096
|
+
command.dvmId,
|
|
9097
|
+
command.generation ?? null,
|
|
9098
|
+
command.leaseExpiresAtMs ?? null,
|
|
9099
|
+
command.deadlineMs ?? null,
|
|
9100
|
+
command.timestampMs,
|
|
9101
|
+
command.nonce
|
|
9102
|
+
] : [
|
|
9093
9103
|
"dvmkit-hosting-v1",
|
|
9094
9104
|
command.action,
|
|
9095
9105
|
command.scope,
|
|
@@ -9098,7 +9108,8 @@ function signHostingControl(secret, command) {
|
|
|
9098
9108
|
command.deadlineMs ?? null,
|
|
9099
9109
|
command.timestampMs,
|
|
9100
9110
|
command.nonce
|
|
9101
|
-
]
|
|
9111
|
+
];
|
|
9112
|
+
return createHmac("sha256", secret).update(JSON.stringify(signed)).digest("hex");
|
|
9102
9113
|
}
|
|
9103
9114
|
var HostingControl = class {
|
|
9104
9115
|
constructor(pool, dvmId, config) {
|
|
@@ -9117,7 +9128,7 @@ var HostingControl = class {
|
|
|
9117
9128
|
await this.pool.query(`
|
|
9118
9129
|
CREATE TABLE IF NOT EXISTS sdk_hosting_control (
|
|
9119
9130
|
dvm_id TEXT NOT NULL, scope TEXT NOT NULL, state TEXT NOT NULL,
|
|
9120
|
-
generation BIGINT NOT NULL, deadline_ms BIGINT,
|
|
9131
|
+
generation BIGINT NOT NULL, deadline_ms BIGINT, lease_expires_at_ms BIGINT,
|
|
9121
9132
|
PRIMARY KEY (dvm_id, scope)
|
|
9122
9133
|
);
|
|
9123
9134
|
CREATE TABLE IF NOT EXISTS sdk_hosting_nonces (
|
|
@@ -9135,6 +9146,7 @@ var HostingControl = class {
|
|
|
9135
9146
|
ALTER TABLE sdk_hosting_admissions ADD COLUMN IF NOT EXISTS credit_id TEXT;
|
|
9136
9147
|
ALTER TABLE sdk_hosting_admissions ADD COLUMN IF NOT EXISTS fund_id TEXT;
|
|
9137
9148
|
ALTER TABLE sdk_hosting_admissions ADD COLUMN IF NOT EXISTS payment_artifact_hash TEXT;
|
|
9149
|
+
ALTER TABLE sdk_hosting_control ADD COLUMN IF NOT EXISTS lease_expires_at_ms BIGINT;
|
|
9138
9150
|
CREATE INDEX IF NOT EXISTS sdk_hosting_admissions_pending
|
|
9139
9151
|
ON sdk_hosting_admissions (dvm_id, scope) WHERE outcome = 'pending';
|
|
9140
9152
|
CREATE INDEX IF NOT EXISTS sdk_hosting_admissions_unresolved
|
|
@@ -9148,13 +9160,31 @@ var HostingControl = class {
|
|
|
9148
9160
|
`);
|
|
9149
9161
|
await this.pool.query(
|
|
9150
9162
|
`INSERT INTO sdk_hosting_control (dvm_id, scope, state, generation)
|
|
9151
|
-
VALUES ($1, $2, '
|
|
9163
|
+
VALUES ($1, $2, 'draining', 0) ON CONFLICT DO NOTHING`,
|
|
9152
9164
|
[this.dvmId, this.config.scope]
|
|
9153
9165
|
);
|
|
9166
|
+
const client = await this.pool.connect();
|
|
9167
|
+
try {
|
|
9168
|
+
await client.query("BEGIN");
|
|
9169
|
+
const migrated = await client.query(
|
|
9170
|
+
`UPDATE sdk_hosting_control SET state='draining',
|
|
9171
|
+
deadline_ms=FLOOR(EXTRACT(EPOCH FROM clock_timestamp()) * 1000)::bigint + 3600000
|
|
9172
|
+
WHERE dvm_id=$1 AND scope=$2 AND state='accepting' AND lease_expires_at_ms IS NULL
|
|
9173
|
+
RETURNING deadline_ms`,
|
|
9174
|
+
[this.dvmId, this.config.scope]
|
|
9175
|
+
);
|
|
9176
|
+
if (migrated.rows[0]) await this.pinAdmissionDeadlines(client, Number(migrated.rows[0].deadline_ms));
|
|
9177
|
+
await client.query("COMMIT");
|
|
9178
|
+
} catch (error) {
|
|
9179
|
+
await client.query("ROLLBACK").catch(() => void 0);
|
|
9180
|
+
throw error;
|
|
9181
|
+
} finally {
|
|
9182
|
+
client.release();
|
|
9183
|
+
}
|
|
9154
9184
|
});
|
|
9155
9185
|
}
|
|
9156
9186
|
async authorize(command, signature) {
|
|
9157
|
-
if (command.scope !== this.config.scope || command.dvmId !== this.dvmId || !Number.isSafeInteger(command.timestampMs) || Math.abs(Date.now() - command.timestampMs) > 3e5 || typeof command.nonce !== "string" || !/^[A-Za-z0-9_-]{16,128}$/.test(command.nonce) || !signature || !/^[0-9a-f]{64}$/i.test(signature)) return false;
|
|
9187
|
+
if (command.version !== void 0 && command.version !== 2 || command.version === 2 && command.action !== "resume" || command.version === void 0 && command.leaseExpiresAtMs !== void 0 || command.scope !== this.config.scope || command.dvmId !== this.dvmId || !Number.isSafeInteger(command.timestampMs) || Math.abs(Date.now() - command.timestampMs) > 3e5 || typeof command.nonce !== "string" || !/^[A-Za-z0-9_-]{16,128}$/.test(command.nonce) || !signature || !/^[0-9a-f]{64}$/i.test(signature)) return false;
|
|
9158
9188
|
const actual = Buffer.from(signature, "hex");
|
|
9159
9189
|
const expected = Buffer.from(signHostingControl(this.config.secret, command), "hex");
|
|
9160
9190
|
if (!timingSafeEqual(actual, expected)) return false;
|
|
@@ -9171,11 +9201,14 @@ var HostingControl = class {
|
|
|
9171
9201
|
try {
|
|
9172
9202
|
await client.query("BEGIN");
|
|
9173
9203
|
const { rows } = await client.query(
|
|
9174
|
-
`SELECT state FROM sdk_hosting_control WHERE dvm_id=$1 AND scope=$2 FOR UPDATE`,
|
|
9204
|
+
`SELECT state, lease_expires_at_ms, deadline_ms FROM sdk_hosting_control WHERE dvm_id=$1 AND scope=$2 FOR UPDATE`,
|
|
9175
9205
|
[this.dvmId, this.config.scope]
|
|
9176
9206
|
);
|
|
9177
|
-
|
|
9178
|
-
|
|
9207
|
+
const now = await this.databaseNow(client);
|
|
9208
|
+
const current = rows[0];
|
|
9209
|
+
if (current) await this.expireIfNeeded(client, current, now);
|
|
9210
|
+
if (current?.state !== "accepting" || current.lease_expires_at_ms === null || Number(current.lease_expires_at_ms) <= now) {
|
|
9211
|
+
await client.query("COMMIT");
|
|
9179
9212
|
return false;
|
|
9180
9213
|
}
|
|
9181
9214
|
await client.query(
|
|
@@ -9187,7 +9220,7 @@ var HostingControl = class {
|
|
|
9187
9220
|
this.dvmId,
|
|
9188
9221
|
this.config.scope,
|
|
9189
9222
|
jobId,
|
|
9190
|
-
|
|
9223
|
+
now,
|
|
9191
9224
|
details?.creditId ?? null,
|
|
9192
9225
|
details?.fundId ?? null,
|
|
9193
9226
|
details?.paymentArtifactHash ?? null
|
|
@@ -9228,26 +9261,70 @@ var HostingControl = class {
|
|
|
9228
9261
|
}
|
|
9229
9262
|
async jobDeadline(jobId) {
|
|
9230
9263
|
const { rows } = await this.pool.query(
|
|
9231
|
-
`SELECT
|
|
9264
|
+
`SELECT MIN(drain_deadline_ms)::text AS drain_deadline_ms
|
|
9232
9265
|
FROM sdk_hosting_admissions WHERE dvm_id=$1 AND scope=$2 AND job_id=$3`,
|
|
9233
9266
|
[this.dvmId, this.config.scope, jobId]
|
|
9234
9267
|
);
|
|
9235
9268
|
return rows[0]?.drain_deadline_ms === null || !rows[0] ? null : Number(rows[0].drain_deadline_ms);
|
|
9236
9269
|
}
|
|
9270
|
+
async dispatchDeadlineReached(jobId) {
|
|
9271
|
+
const { rows } = await this.pool.query(
|
|
9272
|
+
`SELECT EXISTS (
|
|
9273
|
+
SELECT 1 FROM sdk_hosting_admissions
|
|
9274
|
+
WHERE dvm_id=$1 AND scope=$2 AND job_id=$3
|
|
9275
|
+
AND drain_deadline_ms <= FLOOR(EXTRACT(EPOCH FROM clock_timestamp()) * 1000)::bigint
|
|
9276
|
+
) OR EXISTS (
|
|
9277
|
+
SELECT 1 FROM sdk_hosting_control
|
|
9278
|
+
WHERE dvm_id=$1 AND scope=$2 AND state='draining'
|
|
9279
|
+
AND deadline_ms <= FLOOR(EXTRACT(EPOCH FROM clock_timestamp()) * 1000)::bigint
|
|
9280
|
+
) AS reached`,
|
|
9281
|
+
[this.dvmId, this.config.scope, jobId]
|
|
9282
|
+
);
|
|
9283
|
+
return rows[0]?.reached ?? false;
|
|
9284
|
+
}
|
|
9285
|
+
async databaseNow(client) {
|
|
9286
|
+
const { rows } = await client.query(
|
|
9287
|
+
`SELECT FLOOR(EXTRACT(EPOCH FROM clock_timestamp()) * 1000)::bigint AS now_ms`
|
|
9288
|
+
);
|
|
9289
|
+
return Number(rows[0].now_ms);
|
|
9290
|
+
}
|
|
9291
|
+
async pinAdmissionDeadlines(client, deadlineMs) {
|
|
9292
|
+
await client.query(
|
|
9293
|
+
`UPDATE sdk_hosting_admissions SET drain_deadline_ms=
|
|
9294
|
+
CASE WHEN drain_deadline_ms IS NULL THEN $3 ELSE LEAST(drain_deadline_ms, $3) END
|
|
9295
|
+
WHERE dvm_id=$1 AND scope=$2 AND outcome <> 'failed'`,
|
|
9296
|
+
[this.dvmId, this.config.scope, deadlineMs]
|
|
9297
|
+
);
|
|
9298
|
+
}
|
|
9299
|
+
async expireIfNeeded(client, row, now) {
|
|
9300
|
+
if (row.state !== "accepting" || row.lease_expires_at_ms !== null && Number(row.lease_expires_at_ms) > now) return;
|
|
9301
|
+
const deadline = row.deadline_ms === null ? now + 36e5 : Number(row.deadline_ms);
|
|
9302
|
+
await client.query(
|
|
9303
|
+
`UPDATE sdk_hosting_control SET state='draining', deadline_ms=$3
|
|
9304
|
+
WHERE dvm_id=$1 AND scope=$2`,
|
|
9305
|
+
[this.dvmId, this.config.scope, deadline]
|
|
9306
|
+
);
|
|
9307
|
+
row.state = "draining";
|
|
9308
|
+
row.deadline_ms = String(deadline);
|
|
9309
|
+
await this.pinAdmissionDeadlines(client, deadline);
|
|
9310
|
+
}
|
|
9237
9311
|
async transition(command) {
|
|
9238
|
-
if (command.action !== "drain" && command.action !== "resume" || !Number.isSafeInteger(command.generation) || command.generation < 1 || command.action === "drain" && !Number.isSafeInteger(command.deadlineMs) || command.action === "resume" && command.
|
|
9312
|
+
if (command.action !== "drain" && command.action !== "resume" || !Number.isSafeInteger(command.generation) || command.generation < 1 || command.action === "drain" && (command.version !== void 0 || !Number.isSafeInteger(command.deadlineMs) || command.leaseExpiresAtMs !== void 0) || command.action === "resume" && (command.version !== 2 || !Number.isSafeInteger(command.leaseExpiresAtMs) || !Number.isSafeInteger(command.deadlineMs))) return "conflict";
|
|
9239
9313
|
const client = await this.pool.connect();
|
|
9240
9314
|
try {
|
|
9241
9315
|
await client.query("BEGIN");
|
|
9242
9316
|
const { rows } = await client.query(
|
|
9243
|
-
`SELECT state, generation, deadline_ms FROM sdk_hosting_control
|
|
9317
|
+
`SELECT state, generation, deadline_ms, lease_expires_at_ms FROM sdk_hosting_control
|
|
9244
9318
|
WHERE dvm_id=$1 AND scope=$2 FOR UPDATE`,
|
|
9245
9319
|
[this.dvmId, this.config.scope]
|
|
9246
9320
|
);
|
|
9247
9321
|
const prior = rows[0];
|
|
9322
|
+
if (!prior) throw new Error("Hosting control was not initialized");
|
|
9323
|
+
const now = await this.databaseNow(client);
|
|
9324
|
+
await this.expireIfNeeded(client, prior, now);
|
|
9248
9325
|
const generation = Number(prior.generation);
|
|
9249
9326
|
const nextState = command.action === "drain" ? "draining" : "accepting";
|
|
9250
|
-
if (command.generation === generation && prior.state === nextState && Number(prior.deadline_ms ?? 0) === (command.deadlineMs ?? 0)) {
|
|
9327
|
+
if (command.generation === generation && prior.state === nextState && Number(prior.deadline_ms ?? 0) === (command.deadlineMs ?? 0) && (command.action !== "resume" || Number(prior.lease_expires_at_ms ?? 0) === command.leaseExpiresAtMs)) {
|
|
9251
9328
|
await client.query("COMMIT");
|
|
9252
9329
|
return "ok";
|
|
9253
9330
|
}
|
|
@@ -9255,21 +9332,29 @@ var HostingControl = class {
|
|
|
9255
9332
|
await client.query("ROLLBACK");
|
|
9256
9333
|
return "conflict";
|
|
9257
9334
|
}
|
|
9258
|
-
if (command.action === "drain" && (command.deadlineMs <=
|
|
9335
|
+
if (command.action === "drain" && (command.deadlineMs <= now || command.deadlineMs > now + 864e5)) {
|
|
9336
|
+
await client.query("ROLLBACK");
|
|
9337
|
+
return "conflict";
|
|
9338
|
+
}
|
|
9339
|
+
if (command.action === "resume" && (command.leaseExpiresAtMs <= now || command.leaseExpiresAtMs > now + 36e5 || command.deadlineMs <= command.leaseExpiresAtMs || command.deadlineMs > command.leaseExpiresAtMs + 36e5)) {
|
|
9259
9340
|
await client.query("ROLLBACK");
|
|
9260
9341
|
return "conflict";
|
|
9261
9342
|
}
|
|
9262
9343
|
await client.query(
|
|
9263
|
-
`UPDATE sdk_hosting_control SET state=$3, generation=$4, deadline_ms=$5
|
|
9344
|
+
`UPDATE sdk_hosting_control SET state=$3, generation=$4, deadline_ms=$5,
|
|
9345
|
+
lease_expires_at_ms=$6
|
|
9264
9346
|
WHERE dvm_id=$1 AND scope=$2`,
|
|
9265
|
-
[
|
|
9347
|
+
[
|
|
9348
|
+
this.dvmId,
|
|
9349
|
+
this.config.scope,
|
|
9350
|
+
nextState,
|
|
9351
|
+
command.generation,
|
|
9352
|
+
command.deadlineMs ?? null,
|
|
9353
|
+
command.action === "resume" ? command.leaseExpiresAtMs : null
|
|
9354
|
+
]
|
|
9266
9355
|
);
|
|
9267
9356
|
if (command.action === "drain") {
|
|
9268
|
-
await client.
|
|
9269
|
-
`UPDATE sdk_hosting_admissions SET drain_deadline_ms=$3
|
|
9270
|
-
WHERE dvm_id=$1 AND scope=$2 AND outcome='pending'`,
|
|
9271
|
-
[this.dvmId, this.config.scope, command.deadlineMs]
|
|
9272
|
-
);
|
|
9357
|
+
await this.pinAdmissionDeadlines(client, command.deadlineMs);
|
|
9273
9358
|
}
|
|
9274
9359
|
await client.query("COMMIT");
|
|
9275
9360
|
return "ok";
|
|
@@ -9281,6 +9366,22 @@ var HostingControl = class {
|
|
|
9281
9366
|
}
|
|
9282
9367
|
}
|
|
9283
9368
|
async status() {
|
|
9369
|
+
const client = await this.pool.connect();
|
|
9370
|
+
try {
|
|
9371
|
+
await client.query("BEGIN");
|
|
9372
|
+
const locked = await client.query(
|
|
9373
|
+
`SELECT state, deadline_ms, lease_expires_at_ms FROM sdk_hosting_control
|
|
9374
|
+
WHERE dvm_id=$1 AND scope=$2 FOR UPDATE`,
|
|
9375
|
+
[this.dvmId, this.config.scope]
|
|
9376
|
+
);
|
|
9377
|
+
if (locked.rows[0]) await this.expireIfNeeded(client, locked.rows[0], await this.databaseNow(client));
|
|
9378
|
+
await client.query("COMMIT");
|
|
9379
|
+
} catch (error) {
|
|
9380
|
+
await client.query("ROLLBACK").catch(() => void 0);
|
|
9381
|
+
throw error;
|
|
9382
|
+
} finally {
|
|
9383
|
+
client.release();
|
|
9384
|
+
}
|
|
9284
9385
|
await this.pool.query(
|
|
9285
9386
|
`UPDATE sdk_hosting_admissions a SET outcome='accepted'
|
|
9286
9387
|
WHERE a.dvm_id=$1 AND a.scope=$2 AND a.outcome='pending'
|
|
@@ -9300,7 +9401,7 @@ var HostingControl = class {
|
|
|
9300
9401
|
[this.dvmId, this.config.scope]
|
|
9301
9402
|
);
|
|
9302
9403
|
const { rows } = await this.pool.query(
|
|
9303
|
-
`SELECT state, generation, deadline_ms FROM sdk_hosting_control WHERE dvm_id=$1 AND scope=$2`,
|
|
9404
|
+
`SELECT state, generation, deadline_ms, lease_expires_at_ms FROM sdk_hosting_control WHERE dvm_id=$1 AND scope=$2`,
|
|
9304
9405
|
[this.dvmId, this.config.scope]
|
|
9305
9406
|
);
|
|
9306
9407
|
const active = await this.pool.query(
|
|
@@ -9339,6 +9440,7 @@ var HostingControl = class {
|
|
|
9339
9440
|
state: rows[0].state,
|
|
9340
9441
|
generation: Number(rows[0].generation),
|
|
9341
9442
|
deadlineMs: rows[0].deadline_ms === null ? null : Number(rows[0].deadline_ms),
|
|
9443
|
+
leaseExpiresAtMs: rows[0].lease_expires_at_ms === null ? null : Number(rows[0].lease_expires_at_ms),
|
|
9342
9444
|
activeJobIds: active.rows.map((row) => row.id),
|
|
9343
9445
|
unownedActiveJobIds: unowned.rows.map((row) => row.id),
|
|
9344
9446
|
pendingAdmissionCount: Number(pending.rows[0].pending),
|
|
@@ -17432,12 +17534,10 @@ var DVMServer = class {
|
|
|
17432
17534
|
const control = this.opts.hostingControlInstance;
|
|
17433
17535
|
if (!control) return;
|
|
17434
17536
|
const status = await control.status();
|
|
17435
|
-
if (status.state !== "draining" || status.deadlineMs === null || Date.now() < status.deadlineMs)
|
|
17436
|
-
return;
|
|
17437
17537
|
const store = this.jobManager.store;
|
|
17438
17538
|
if (!(store instanceof PostgresJobStore)) return;
|
|
17439
17539
|
for (const jobId of status.activeJobIds) {
|
|
17440
|
-
if (await store.cancelJobForHosting(jobId, "Hosting drain deadline reached")) {
|
|
17540
|
+
if (await control.dispatchDeadlineReached(jobId) && await store.cancelJobForHosting(jobId, "Hosting drain deadline reached")) {
|
|
17441
17541
|
await this.jobManager.finalizeStoredTerminal(jobId);
|
|
17442
17542
|
}
|
|
17443
17543
|
}
|
|
@@ -18965,14 +19065,25 @@ var DVMServer = class {
|
|
|
18965
19065
|
payment = recoveredPayment;
|
|
18966
19066
|
resumedAcceptedPayment = true;
|
|
18967
19067
|
}
|
|
18968
|
-
|
|
19068
|
+
const skipPayment = devModeSkipsPaymentVerification(this.opts);
|
|
19069
|
+
let priceMsats = resumeOnly ? payment.paidMsats || void 0 : void 0;
|
|
19070
|
+
if (!resumeOnly && !skipPayment) {
|
|
19071
|
+
try {
|
|
19072
|
+
priceMsats = await this.jobManager.currentPriceMsats(capabilityName);
|
|
19073
|
+
} catch (err) {
|
|
19074
|
+
const fxErr = pickFxRateUnavailable(err);
|
|
19075
|
+
if (fxErr) return c.json({ error: fxErr }, 503);
|
|
19076
|
+
throw err;
|
|
19077
|
+
}
|
|
19078
|
+
}
|
|
18969
19079
|
let dynamicUpfront;
|
|
18970
|
-
if (!resumeOnly && priceMsats === void 0 && cap.onQuote) {
|
|
19080
|
+
if (!resumeOnly && cap.price === void 0 && priceMsats === void 0 && cap.onQuote) {
|
|
18971
19081
|
const dyn = await this.computeDynamicPrice(
|
|
18972
19082
|
cap.onQuote,
|
|
18973
19083
|
parsedInput,
|
|
18974
19084
|
normalisedBody,
|
|
18975
|
-
authPubkey
|
|
19085
|
+
authPubkey,
|
|
19086
|
+
skipPayment
|
|
18976
19087
|
);
|
|
18977
19088
|
if (dyn.error) return c.json(dyn.error.body, dyn.error.status);
|
|
18978
19089
|
priceMsats = dyn.priceMsats;
|
|
@@ -19004,7 +19115,6 @@ var DVMServer = class {
|
|
|
19004
19115
|
}
|
|
19005
19116
|
}
|
|
19006
19117
|
}
|
|
19007
|
-
const skipPayment = devModeSkipsPaymentVerification(this.opts);
|
|
19008
19118
|
if (!skipPayment && !resumedAcceptedPayment) {
|
|
19009
19119
|
const railOpts = await this.railVerifyOpts(c);
|
|
19010
19120
|
hostingPaymentMayHaveLanded = Boolean(
|
|
@@ -19193,10 +19303,8 @@ var DVMServer = class {
|
|
|
19193
19303
|
await this.opts.hostingControlInstance.finishAdmission(hostingAdmissionId, "accepted", jobId);
|
|
19194
19304
|
hostingAdmissionAccepted = true;
|
|
19195
19305
|
}
|
|
19196
|
-
|
|
19197
|
-
|
|
19198
|
-
const currentDrainDeadline = hostingStatus?.state === "draining" ? hostingStatus.deadlineMs : null;
|
|
19199
|
-
if (reservedDrainDeadline !== null && Date.now() >= reservedDrainDeadline || currentDrainDeadline !== null && currentDrainDeadline !== void 0 && Date.now() >= currentDrainDeadline) {
|
|
19306
|
+
await this.opts.hostingControlInstance?.status();
|
|
19307
|
+
if (this.opts.hostingControlInstance && await this.opts.hostingControlInstance.dispatchDeadlineReached(jobId)) {
|
|
19200
19308
|
const store = jm.store;
|
|
19201
19309
|
if (store instanceof PostgresJobStore && await store.cancelJobForHosting(jobId, "Hosting drain deadline reached")) {
|
|
19202
19310
|
await jm.finalizeStoredTerminal(jobId);
|
|
@@ -19422,9 +19530,9 @@ var DVMServer = class {
|
|
|
19422
19530
|
/**
|
|
19423
19531
|
* Recompute dynamic upfront pricing from parsed job input, applying the quote
|
|
19424
19532
|
* schema separately. Refuse invalid input/results, currency mismatch or missing
|
|
19425
|
-
* FX
|
|
19533
|
+
* FX when payment needs a price (400/500/503 as classified below).
|
|
19426
19534
|
*/
|
|
19427
|
-
async computeDynamicPrice(onQuote, parsedInput, body, callerPubkey) {
|
|
19535
|
+
async computeDynamicPrice(onQuote, parsedInput, body, callerPubkey, skipRateConversion = false) {
|
|
19428
19536
|
let data = parsedInput;
|
|
19429
19537
|
if (isZodSchema(onQuote.schema)) {
|
|
19430
19538
|
const parsed = onQuote.schema.safeParse(parsedInput);
|
|
@@ -19456,6 +19564,9 @@ var DVMServer = class {
|
|
|
19456
19564
|
if (!supported.includes(upfrontCurrency)) {
|
|
19457
19565
|
throw new UnsupportedCurrencyError(upfrontCurrency, supported);
|
|
19458
19566
|
}
|
|
19567
|
+
if (skipRateConversion) {
|
|
19568
|
+
return { upfront: { amount: validated.upfront.amount, currency: upfrontCurrency } };
|
|
19569
|
+
}
|
|
19459
19570
|
const fx = await this.fxFetcher.fetch();
|
|
19460
19571
|
const priceMsats = fiatToSatsCeil(validated.upfront.amount, fxRateFor(fx, upfrontCurrency)) * 1e3;
|
|
19461
19572
|
return {
|
|
@@ -188,6 +188,8 @@ interface HostingControlConfig {
|
|
|
188
188
|
scope: string;
|
|
189
189
|
}
|
|
190
190
|
interface HostingControlCommand {
|
|
191
|
+
/** Version two is required for resume; version one remains valid for drain and status. */
|
|
192
|
+
version?: 2;
|
|
191
193
|
action: "drain" | "resume" | "status";
|
|
192
194
|
scope: string;
|
|
193
195
|
dvmId: string;
|
|
@@ -195,13 +197,15 @@ interface HostingControlCommand {
|
|
|
195
197
|
nonce: string;
|
|
196
198
|
generation?: number;
|
|
197
199
|
deadlineMs?: number;
|
|
200
|
+
leaseExpiresAtMs?: number;
|
|
198
201
|
}
|
|
199
|
-
/**
|
|
202
|
+
/** Ordered JSON arrays are the versioned wire signing contract. */
|
|
200
203
|
declare function signHostingControl(secret: string, command: HostingControlCommand): string;
|
|
201
204
|
interface HostingControlStatus {
|
|
202
205
|
state: "accepting" | "draining";
|
|
203
206
|
generation: number;
|
|
204
207
|
deadlineMs: number | null;
|
|
208
|
+
leaseExpiresAtMs: number | null;
|
|
205
209
|
activeJobIds: string[];
|
|
206
210
|
unownedActiveJobIds: string[];
|
|
207
211
|
pendingAdmissionCount: number;
|
|
@@ -4330,6 +4330,11 @@ interface DeferredFunding {
|
|
|
4330
4330
|
pinnedRail?: CreditFundRail;
|
|
4331
4331
|
pinnedRailSource?: ForcedFundingRail["source"];
|
|
4332
4332
|
}
|
|
4333
|
+
/** Explains an eligible automatic purchase left per-call; carries no spending authorization or amounts. */
|
|
4334
|
+
interface FundingSkip {
|
|
4335
|
+
reason: "btc_rate_unavailable";
|
|
4336
|
+
operation: "open" | "refill";
|
|
4337
|
+
}
|
|
4333
4338
|
type CreditPlan =
|
|
4334
4339
|
/**
|
|
4335
4340
|
* Per-call implicit N=1 — wire-identical to the pre-credits request.
|
|
@@ -4343,6 +4348,7 @@ type CreditPlan =
|
|
|
4343
4348
|
suppressed?: SuppressedPurchase;
|
|
4344
4349
|
deferred?: DeferredFunding;
|
|
4345
4350
|
drawSkipped?: DrawSkip;
|
|
4351
|
+
fundingSkipped?: FundingSkip;
|
|
4346
4352
|
}
|
|
4347
4353
|
/** Draw on an existing credit: credit fields in the signed body, no payment attach. */
|
|
4348
4354
|
| {
|
|
@@ -8962,4 +8968,4 @@ declare function readX402ChannelOnChain(args: {
|
|
|
8962
8968
|
*/
|
|
8963
8969
|
declare function x402ChannelControlledBy(channel: StoredX402ChannelMetadata, address: string | null | undefined): boolean;
|
|
8964
8970
|
|
|
8965
|
-
export { ADMIN_STATE_UNAVAILABLE, AGENT_MNEMONIC_FILE, type AgentProof, type AgentWallet, type AmountLabelOptions, type AttestedDvmIdentity, BTC_RATE_FILE, BUDGET_FILE, type BudgetCaps, 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, CREDIT_POSTURES, type CachedBtcRate, type CancelOptions, type CashOutMintOutcome, type CashOutQuote, type CliIdentityEntry, type CoinGeckoBtcSpot, type CoinGeckoSpot, type Config, type ConfigBackupInfo, type ConfigDirModeResult, type ConfigField, type ConfigRollbackPreview, type ConfigSnapshotSlot, CreatedInvoice, type CreditConfig, type CreditDrainRail, type CreditFundOutcome, type CreditFundRail, type CreditFundStatus, type CreditFundingMode, type CreditMenu, type CreditOpResult, type CreditPlan, type CreditPosture, type CreditRailPick, type CreditRailReason, type CreditRailSource, type CreditTerms, type CreditWire, DEFAULT_AGENT_MINT_URL, DEFAULT_CREDIT_POSTURE, DEFAULT_RESERVE_LOCKTIME_SECONDS, DbTransport, type DeferredFunding, type DeliveredResult, type DescribeOptions, type DrainReceiptChecks, type DrainReceiptVerifyResult, type DrainWire, type DrawCeilingSource, type DrawSkip, DvmError, DvmX402ChannelStorage, type EffectiveFundingRail, FAVORITES_FILE, FEEDBACK_NUDGES_FILE, FEEDBACK_POSTURES, type FeedbackPosture, type Float, type FloatPayment, type FloatProbe, type FundCreditArgs, FundingReceipt, type FundingReceiptChecks, type FundingReceiptVerifyResult, IDENTITIES_FILE, IDENTITIES_VERSION, type IdentitiesFile, InvoiceStatus, JOBS_FILE, type JobCompletion, type JobEnvelope, type JobPolicy, JobReceipt$1 as JobReceipt, type JobRecord, type JobStatus, JsonValue, LightningBackend, type LightningFundingOffer, LightningPayment, LightningTransactionListOptions, LightningTransactionSnapshot, LightningWalletInfo, type LnAddressParts, MESSAGES_DIR, type MeltQuoteInfo, type MeltSweepResult, MemoryKVStore, Message, type MessagePollOptions, MessageType, MintAmountBounds, MintHealthCheckResult, type MintSource, type MnemonicValidationResult, MppxChallenge, MppxCredential, NWC_FUNDING_FLOAT_ROLE, type NextAction, type NextActionRefund, 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, type PaymentRailKey, PaymentRequired, type PendingDrain, type PendingFunding, type PendingMint, type PendingSubmission, type PendingX402ExactFunding, type PendingX402Funding, type PersistedOutputData, PersistentCounterSource, type PreparedAgentSpend, type ProtectedTarget, type ProviderInfo, type ProviderRef, type ProviderText, type Quote, RAIL_FLAGS, RECEIPTS_FILE, RECENT_SPENDS_CAP, RECOMMENDED_MINTS, RECOVERY_MNEMONIC_FILE, REQUEST_INTENTS_DIR, RESUME_MAX_AGE_MS, RESUME_MAX_ATTEMPTS, ROUTER_FEEDBACK_CLAIM_HEADER, ROUTER_FEEDBACK_CLAIM_TTL_MS, type Rail, type RailFlag, type RailProbe, type ReceiptCapture, type ReceiptChecks, ReceiptCredit, type ReceiptInvalidReason, type ReceiptKeypair, type ReceiptParseError, type ReceiptTrustAnchor, type ReceiptVerification, type ReceiptVerifyResult, type ReleaseMintOutcome, type ResolvedBtcRate, ResourceInfo, SPANS_INSERTED_CHANNEL, STABLECOIN_FUND_RAILS, SUPPORTED_PROTOCOL_VERSION, type SelectError, type SendMessageOptions, type SpanRow, type SpanTransport, SpanWriter, type StaleRateNotice, type StatusOptions, type StoredCredit, type StoredFundingMenuSnapshot, type StoredImplicitCredit, type StoredReceipt, type StoredSiblingCredit, type StoredX402ChannelConfig, type StoredX402ChannelMetadata, type StreamOptions, type StreamResult, type SubmissionSweepOutcome, type SubmitOptions, type SuppressedPurchase, type SweepResult, TEMPO_CHAIN_ID, TEMPO_CHANNELS_FILE, TEMPO_EXIT_KEY_MISSING_HINT, TEMPO_MODERATO_CHAIN_ID, TEMPO_MODERATO_RPC, TEMPO_PATH_USD_MODERATO, type TempoAccount, type TempoChannelAssociation, type TempoChannelExitResult, type TempoChannelReconcileResult, type TempoNetwork, type TerminalJobStatus, type Transport, type JobReceipt as TransportJobReceipt, type TrustAnchorRead, type TrustLadder, type V1InfoCapability, type V1InfoResponse, type VerifyJobReceiptArgs, WALLET_FILE, WALLET_VERSION, type WalletInfo, type X402Asset, type X402Balance, type X402BatchPayment, type X402ChannelChainReport, type X402ChannelClient, type X402ChannelReconciliation, type X402ConnectedWallet, type X402CreditFlavour, type X402CreditInstrument, X402EnvValidationError, type X402Network, type X402PaymentProof, type X402RefundArgs, type X402RefundOutcome, type X402RepinnedWallet, type X402UnobservedBalanceProvenance, X402Version, 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, abandonPendingSubmission, acknowledgeReplayedX402Payment, acknowledgeX402ChannelOwner, addPayment, advanceTempoChannelExit, applyImplicitReceiptCredit, applyReceiptCredit, applyRetryToPool, asProviderText, asProviderTextOpt, assertAgentMnemonicReplaceable, assertFloatBudget, assertSupportedX402Network, assertTempoWalletIdle, assertValidBudget, assertX402ChannelPayer, assertX402RequirementDescribesChannel, assertX402WalletIdle, attestedDvmIdentity, authenticatedBuilderPubkey, authorizeProtectedRemoval, automaticCreditBoundRail, availableRails, backfillTrustAnchor, backupSecretFile, buildAdminAuthHeader, buildAdminChallenge, buildCompletionHintFields, buildDisplayMintInventory, buildPolicy, buildTempoCredential, builderLockPath, canReplaceExpiredX402Deposit, captureFundingReceipt, captureTransportReceipt, cashOutFromMint, cashuSubmissionBindingFingerprint, checkMeltQuoteState, checkReceiptAttestation, clearCreditSelection, clearPendingDrain, clearPendingX402ExactFunding, clearPendingX402Funding, clearRefillRailUnavailable, generateIdentity as cliIdentityStoreGenerateIdentity, commitAgentSpend, completionFromMessages, completionSnapshot, computeNextAction, computeSmartDenominations, configSnapshotPath, connectedTempoAccount, connectedX402Payer, correctPendingFundAmount, costAnchor, coveringMintsForSpend, createMonotonicClock, createNoopLogger, createStdoutLogger, createTempoCloseCredential, createX402BatchPayment, currentContext, deleteAgentMnemonic, deriveAgentMasterKeypair, deriveBuilderLockKeypair, deriveBuilderLockPubkey, deriveIdentityFromPrivkey, derivePubkeyFromPrivkey, deriveReceiptKeypair, deriveReceiptSecret, deriveTempoAddress, describeConfigBackup, describeMintBounds, drainReceiptsDisplay, drainReceiptsHint, dvmLocationIdentity, effectiveCreditPosture, effectiveFundingMint, effectiveFundingRail, effectiveMints, emitFloatBudgetWarning, enforceGlobalBudget, ensureAddress, ensureConfig, ensureConfigDir, ensureConfigSubdir, ensureProvisionalCredit, entryKind, epochMsToIso, extractBuilderHandle, fetchBtcUsdRate, fetchCoinGeckoBtcUsd, fetchCoinGeckoSpot, fetchLnurlPayInvoice, fetchMeltQuote, fetchMissingJobReceipt, fetchTrustAnchor, findSigningIdentityByPubkey, findX402Channel, floatBudgetJson, floatPaymentDisplay, floatPaymentJson, forgetCredit, formatAmount, formatAmountBestEffort, formatLocktime, formatPaymentAmount, formatSats, formatStaleness, formatUsd, formatUsdcMicrounits, fundAgentWallet, fundCredit, fundWireAmountMicro, fundingModeForTempoIntent, fundingModeForX402Flavour, fundingRailLabel, generateAgentMnemonic, generateEphemeralReceiptKey, generateTempoKey, generateX402PrivateKey, getBalance, getBalanceByMint, getFundingGuidance, getInfo, getInputFeesForProofs, getLastKnownBtcRate, getOutputTraceId, getTempoUsdcBalance, getX402Balance, hashedCanonicalDvmId, identitiesFileExists, info, initLoggers, insertSpanBatch, isAbortError, isCreditFundRail, isCreditFundingMode, isCreditPosture, isFeedbackPosture, isPaymentRailKey, isPublicRequestId, isResumable, isStablecoinFundRail, isTerminalJobStatus, isValidEvmPrivateKey, issueRouterFeedbackClaim, json, listCredits, listFundingMenuSnapshots, listImplicitCredits, listPendingFundings, listPendingX402Fundings, listPendingX402FundingsForChannel, listResumableTempoChargeFundings, listResumableX402ExactFundings, listResumableX402Fundings, listTempoChannelAssociations, listTransactions, listX402Channels, loadAgentWallet, loadAllJobs, loadConfig, loadConfiguredMints, loadCredit, loadFloat, loadIdentities, loadImplicitCredits, loadJob, loadLedger, loadPendingFunding, loadReceipt, loadReceipts, loadResumableX402ExactFunding, loadResumableX402Funding, loadTempoChannelAssociation, loadTempoChannelController, loadTempoChannelEntry, loadX402Wallet, loggers, looksLikeMnemonic, lookupInvoice, makeInvoice, markCredit, markImplicitCreditLost, markJobTerminal, markRefillDrainNoticed, markRefillRailUnavailable, maxKeysetDenomination, microToSats, missingDleqRecoveryDiagnostic, mnemonicFingerprint, monetaryJson, msatsToMicro, msatsToUsd, msatsToUsdCents, msatsToUsdc, needsPocketRefill, needsTopup, nextStepHint, normalizeCreditEndpoint, normalizeFeedbackEndpointHost, nwcDedupWindowMs, nwcRejectionDisplay, nwcTimeoutMs, offersTempoCreditFunding, offersX402CreditFunding, parseBudget, parseCreditMenu, parseCreditTerms, parseLnAddress, parseLocktime, parseNwcUri, parseStatedBudget, parseTraceparent, payInvoiceReconciling, payViaFloat, paymentRailLabel, pendingDrainById, pendingDrainFor, pickCreditFundRail, pinConfigSnapshot, pinDimension, planConfigReset, planCreditForQuote, planProbeDraw, pocketTargetMicro, pollNextAction, pollPendingCreditFundings, preferLightningFirst, prepareAgentSpend, prepareP2PKMint, previewConfigRollback, printFundingGuidance, probeFloat, probeRailLabel, probeWallets, processX402BatchCorrection, processX402BatchResponse, processX402BatchResponseForWallet, providerProseSources, providerTextToString, railLabelAtSentenceStart, randomTraceId, raw, readFundValuation, readX402ChannelOnChain, receiptDisplay, receiptFailureDetail, receiptHint, receiptIssuedAtIso, receiptJsonFields, receiptPubkeyFromSecret, receiptTrustFields, receiveToAgentWallet, reclaimAtMs, reconcileRefusedX402Deposits, reconcileTempoChannelOnChain, recordBalanceResponse, recordCreditX402Instrument, recordDrainReceipts, recordFloatSpend, recordFundResponse, recordFundingMenuSnapshot, recordPendingDrain, recordPendingX402ExactFunding, recordPendingX402Funding, recordRefusedDrawBalance, recordSpend, recordX402ChannelMetadata, recoverPendingSubmission, redactUrl, redactUrlsInText, refFromJob, refundX402BatchChannel, releaseAgentReserve, removeX402Wallet, renderReceiptHuman, repairConfigDirMode, repinX402WalletNetwork, replayStoredReceipt, reserveAgentWallet, resolveBtcUsdRate, resolveFundMint, resolveLnurlPayMetadataUrl, resolveRpcHttpTransportOptions, resolveRpcOverride, resolveSigningIdentity, resolveTempoAsset, resolveTempoNetwork, resolveX402Asset, resolveX402ChannelRpc, restoreProofsFromOutputs, retireConfigBackup, retirePendingX402Funding, rollbackConfig, rpcEndpointLine, rpcEndpointSuffix, saveAgentWallet, saveIdentities, saveJob, saveLedger, saveX402Wallet, selectProofsForSpend, serializeOutputData, setEmitter, setOutputTraceId, settleDrainEvidence, shellQuoteArg, signDvmRequestData, signRequestData, signedRequestDomain, spendableAt, staleRateNotice, statusSnapshot, swapFeeForProofs, swapSendReserve, sweepPendingMelts, sweepPendingMints, sweepPendingSubmissions, sweepStaleInFlight, tempoBalanceCheckHint, tempoChannelControlledBy, tempoCredentialAmountMicro, tempoKeyImportRoutes, tempoSessionChallenge, tempoSessionChallengeMicro, tempoTokenReference, tempoWrongAssetHint, tierCapOverrides, toAgentProof, toFloatError, transportErrorCode, trustLadderFor, trustOverrideCapMicro, tryResolveBtcUsdRate, tryResolveTempoAsset, tryX402Payment, unreachableRailDisplay, unreachableRailHint, unrecordedFloatBudgetWarning, unsignRequestData, updateConfig, updateJob, usdToMsats, usdcToMsats, validateAgentMnemonic, validateLnAddress, validateX402Env, verifyCanonicalSignedRequest, verifyChallenge, verifyDrainReceiptChain, verifyFundingReceiptChain, verifyJobReceipt, verifyRouterFeedbackClaim, walletExists, weakestReceiptVerdict, windowStart, withIdentitiesLock, withInitRetry, withNwcPool, withTempoChannelLock, withTraceContext, withWalletLock, withX402ChannelLock, writeAgentMnemonic, x402ChannelBalanceUnreconciledAt, x402ChannelControlledBy, x402ChannelReservation, x402CreditChannelNetworks, x402CreditExactNetworks, x402ExactFundingDead, x402FlavourForInstrument, x402NetworkByCaip2, x402NetworkBySlug, x402NetworkLabel, x402NetworkListForCopy, x402PendingBlockExpiresAt, x402PendingDepositExpiresAt, x402PendingFundingJson, x402PendingRetired, x402PendingStale, x402PendingUnsettled, x402RequiredFromError, x402ReservationRelease, x402SupportedNetworksHint, x402VoucherPendingRefusal, x402WrongAssetHint };
|
|
8971
|
+
export { ADMIN_STATE_UNAVAILABLE, AGENT_MNEMONIC_FILE, type AgentProof, type AgentWallet, type AmountLabelOptions, type AttestedDvmIdentity, BTC_RATE_FILE, BUDGET_FILE, type BudgetCaps, 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, CREDIT_POSTURES, type CachedBtcRate, type CancelOptions, type CashOutMintOutcome, type CashOutQuote, type CliIdentityEntry, type CoinGeckoBtcSpot, type CoinGeckoSpot, type Config, type ConfigBackupInfo, type ConfigDirModeResult, type ConfigField, type ConfigRollbackPreview, type ConfigSnapshotSlot, CreatedInvoice, type CreditConfig, type CreditDrainRail, type CreditFundOutcome, type CreditFundRail, type CreditFundStatus, type CreditFundingMode, type CreditMenu, type CreditOpResult, type CreditPlan, type CreditPosture, type CreditRailPick, type CreditRailReason, type CreditRailSource, type CreditTerms, type CreditWire, DEFAULT_AGENT_MINT_URL, DEFAULT_CREDIT_POSTURE, DEFAULT_RESERVE_LOCKTIME_SECONDS, DbTransport, type DeferredFunding, type DeliveredResult, type DescribeOptions, type DrainReceiptChecks, type DrainReceiptVerifyResult, type DrainWire, type DrawCeilingSource, type DrawSkip, DvmError, DvmX402ChannelStorage, type EffectiveFundingRail, FAVORITES_FILE, FEEDBACK_NUDGES_FILE, FEEDBACK_POSTURES, type FeedbackPosture, type Float, type FloatPayment, type FloatProbe, type FundCreditArgs, FundingReceipt, type FundingReceiptChecks, type FundingReceiptVerifyResult, type FundingSkip, IDENTITIES_FILE, IDENTITIES_VERSION, type IdentitiesFile, InvoiceStatus, JOBS_FILE, type JobCompletion, type JobEnvelope, type JobPolicy, JobReceipt$1 as JobReceipt, type JobRecord, type JobStatus, JsonValue, LightningBackend, type LightningFundingOffer, LightningPayment, LightningTransactionListOptions, LightningTransactionSnapshot, LightningWalletInfo, type LnAddressParts, MESSAGES_DIR, type MeltQuoteInfo, type MeltSweepResult, MemoryKVStore, Message, type MessagePollOptions, MessageType, MintAmountBounds, MintHealthCheckResult, type MintSource, type MnemonicValidationResult, MppxChallenge, MppxCredential, NWC_FUNDING_FLOAT_ROLE, type NextAction, type NextActionRefund, 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, type PaymentRailKey, PaymentRequired, type PendingDrain, type PendingFunding, type PendingMint, type PendingSubmission, type PendingX402ExactFunding, type PendingX402Funding, type PersistedOutputData, PersistentCounterSource, type PreparedAgentSpend, type ProtectedTarget, type ProviderInfo, type ProviderRef, type ProviderText, type Quote, RAIL_FLAGS, RECEIPTS_FILE, RECENT_SPENDS_CAP, RECOMMENDED_MINTS, RECOVERY_MNEMONIC_FILE, REQUEST_INTENTS_DIR, RESUME_MAX_AGE_MS, RESUME_MAX_ATTEMPTS, ROUTER_FEEDBACK_CLAIM_HEADER, ROUTER_FEEDBACK_CLAIM_TTL_MS, type Rail, type RailFlag, type RailProbe, type ReceiptCapture, type ReceiptChecks, ReceiptCredit, type ReceiptInvalidReason, type ReceiptKeypair, type ReceiptParseError, type ReceiptTrustAnchor, type ReceiptVerification, type ReceiptVerifyResult, type ReleaseMintOutcome, type ResolvedBtcRate, ResourceInfo, SPANS_INSERTED_CHANNEL, STABLECOIN_FUND_RAILS, SUPPORTED_PROTOCOL_VERSION, type SelectError, type SendMessageOptions, type SpanRow, type SpanTransport, SpanWriter, type StaleRateNotice, type StatusOptions, type StoredCredit, type StoredFundingMenuSnapshot, type StoredImplicitCredit, type StoredReceipt, type StoredSiblingCredit, type StoredX402ChannelConfig, type StoredX402ChannelMetadata, type StreamOptions, type StreamResult, type SubmissionSweepOutcome, type SubmitOptions, type SuppressedPurchase, type SweepResult, TEMPO_CHAIN_ID, TEMPO_CHANNELS_FILE, TEMPO_EXIT_KEY_MISSING_HINT, TEMPO_MODERATO_CHAIN_ID, TEMPO_MODERATO_RPC, TEMPO_PATH_USD_MODERATO, type TempoAccount, type TempoChannelAssociation, type TempoChannelExitResult, type TempoChannelReconcileResult, type TempoNetwork, type TerminalJobStatus, type Transport, type JobReceipt as TransportJobReceipt, type TrustAnchorRead, type TrustLadder, type V1InfoCapability, type V1InfoResponse, type VerifyJobReceiptArgs, WALLET_FILE, WALLET_VERSION, type WalletInfo, type X402Asset, type X402Balance, type X402BatchPayment, type X402ChannelChainReport, type X402ChannelClient, type X402ChannelReconciliation, type X402ConnectedWallet, type X402CreditFlavour, type X402CreditInstrument, X402EnvValidationError, type X402Network, type X402PaymentProof, type X402RefundArgs, type X402RefundOutcome, type X402RepinnedWallet, type X402UnobservedBalanceProvenance, X402Version, 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, abandonPendingSubmission, acknowledgeReplayedX402Payment, acknowledgeX402ChannelOwner, addPayment, advanceTempoChannelExit, applyImplicitReceiptCredit, applyReceiptCredit, applyRetryToPool, asProviderText, asProviderTextOpt, assertAgentMnemonicReplaceable, assertFloatBudget, assertSupportedX402Network, assertTempoWalletIdle, assertValidBudget, assertX402ChannelPayer, assertX402RequirementDescribesChannel, assertX402WalletIdle, attestedDvmIdentity, authenticatedBuilderPubkey, authorizeProtectedRemoval, automaticCreditBoundRail, availableRails, backfillTrustAnchor, backupSecretFile, buildAdminAuthHeader, buildAdminChallenge, buildCompletionHintFields, buildDisplayMintInventory, buildPolicy, buildTempoCredential, builderLockPath, canReplaceExpiredX402Deposit, captureFundingReceipt, captureTransportReceipt, cashOutFromMint, cashuSubmissionBindingFingerprint, checkMeltQuoteState, checkReceiptAttestation, clearCreditSelection, clearPendingDrain, clearPendingX402ExactFunding, clearPendingX402Funding, clearRefillRailUnavailable, generateIdentity as cliIdentityStoreGenerateIdentity, commitAgentSpend, completionFromMessages, completionSnapshot, computeNextAction, computeSmartDenominations, configSnapshotPath, connectedTempoAccount, connectedX402Payer, correctPendingFundAmount, costAnchor, coveringMintsForSpend, createMonotonicClock, createNoopLogger, createStdoutLogger, createTempoCloseCredential, createX402BatchPayment, currentContext, deleteAgentMnemonic, deriveAgentMasterKeypair, deriveBuilderLockKeypair, deriveBuilderLockPubkey, deriveIdentityFromPrivkey, derivePubkeyFromPrivkey, deriveReceiptKeypair, deriveReceiptSecret, deriveTempoAddress, describeConfigBackup, describeMintBounds, drainReceiptsDisplay, drainReceiptsHint, dvmLocationIdentity, effectiveCreditPosture, effectiveFundingMint, effectiveFundingRail, effectiveMints, emitFloatBudgetWarning, enforceGlobalBudget, ensureAddress, ensureConfig, ensureConfigDir, ensureConfigSubdir, ensureProvisionalCredit, entryKind, epochMsToIso, extractBuilderHandle, fetchBtcUsdRate, fetchCoinGeckoBtcUsd, fetchCoinGeckoSpot, fetchLnurlPayInvoice, fetchMeltQuote, fetchMissingJobReceipt, fetchTrustAnchor, findSigningIdentityByPubkey, findX402Channel, floatBudgetJson, floatPaymentDisplay, floatPaymentJson, forgetCredit, formatAmount, formatAmountBestEffort, formatLocktime, formatPaymentAmount, formatSats, formatStaleness, formatUsd, formatUsdcMicrounits, fundAgentWallet, fundCredit, fundWireAmountMicro, fundingModeForTempoIntent, fundingModeForX402Flavour, fundingRailLabel, generateAgentMnemonic, generateEphemeralReceiptKey, generateTempoKey, generateX402PrivateKey, getBalance, getBalanceByMint, getFundingGuidance, getInfo, getInputFeesForProofs, getLastKnownBtcRate, getOutputTraceId, getTempoUsdcBalance, getX402Balance, hashedCanonicalDvmId, identitiesFileExists, info, initLoggers, insertSpanBatch, isAbortError, isCreditFundRail, isCreditFundingMode, isCreditPosture, isFeedbackPosture, isPaymentRailKey, isPublicRequestId, isResumable, isStablecoinFundRail, isTerminalJobStatus, isValidEvmPrivateKey, issueRouterFeedbackClaim, json, listCredits, listFundingMenuSnapshots, listImplicitCredits, listPendingFundings, listPendingX402Fundings, listPendingX402FundingsForChannel, listResumableTempoChargeFundings, listResumableX402ExactFundings, listResumableX402Fundings, listTempoChannelAssociations, listTransactions, listX402Channels, loadAgentWallet, loadAllJobs, loadConfig, loadConfiguredMints, loadCredit, loadFloat, loadIdentities, loadImplicitCredits, loadJob, loadLedger, loadPendingFunding, loadReceipt, loadReceipts, loadResumableX402ExactFunding, loadResumableX402Funding, loadTempoChannelAssociation, loadTempoChannelController, loadTempoChannelEntry, loadX402Wallet, loggers, looksLikeMnemonic, lookupInvoice, makeInvoice, markCredit, markImplicitCreditLost, markJobTerminal, markRefillDrainNoticed, markRefillRailUnavailable, maxKeysetDenomination, microToSats, missingDleqRecoveryDiagnostic, mnemonicFingerprint, monetaryJson, msatsToMicro, msatsToUsd, msatsToUsdCents, msatsToUsdc, needsPocketRefill, needsTopup, nextStepHint, normalizeCreditEndpoint, normalizeFeedbackEndpointHost, nwcDedupWindowMs, nwcRejectionDisplay, nwcTimeoutMs, offersTempoCreditFunding, offersX402CreditFunding, parseBudget, parseCreditMenu, parseCreditTerms, parseLnAddress, parseLocktime, parseNwcUri, parseStatedBudget, parseTraceparent, payInvoiceReconciling, payViaFloat, paymentRailLabel, pendingDrainById, pendingDrainFor, pickCreditFundRail, pinConfigSnapshot, pinDimension, planConfigReset, planCreditForQuote, planProbeDraw, pocketTargetMicro, pollNextAction, pollPendingCreditFundings, preferLightningFirst, prepareAgentSpend, prepareP2PKMint, previewConfigRollback, printFundingGuidance, probeFloat, probeRailLabel, probeWallets, processX402BatchCorrection, processX402BatchResponse, processX402BatchResponseForWallet, providerProseSources, providerTextToString, railLabelAtSentenceStart, randomTraceId, raw, readFundValuation, readX402ChannelOnChain, receiptDisplay, receiptFailureDetail, receiptHint, receiptIssuedAtIso, receiptJsonFields, receiptPubkeyFromSecret, receiptTrustFields, receiveToAgentWallet, reclaimAtMs, reconcileRefusedX402Deposits, reconcileTempoChannelOnChain, recordBalanceResponse, recordCreditX402Instrument, recordDrainReceipts, recordFloatSpend, recordFundResponse, recordFundingMenuSnapshot, recordPendingDrain, recordPendingX402ExactFunding, recordPendingX402Funding, recordRefusedDrawBalance, recordSpend, recordX402ChannelMetadata, recoverPendingSubmission, redactUrl, redactUrlsInText, refFromJob, refundX402BatchChannel, releaseAgentReserve, removeX402Wallet, renderReceiptHuman, repairConfigDirMode, repinX402WalletNetwork, replayStoredReceipt, reserveAgentWallet, resolveBtcUsdRate, resolveFundMint, resolveLnurlPayMetadataUrl, resolveRpcHttpTransportOptions, resolveRpcOverride, resolveSigningIdentity, resolveTempoAsset, resolveTempoNetwork, resolveX402Asset, resolveX402ChannelRpc, restoreProofsFromOutputs, retireConfigBackup, retirePendingX402Funding, rollbackConfig, rpcEndpointLine, rpcEndpointSuffix, saveAgentWallet, saveIdentities, saveJob, saveLedger, saveX402Wallet, selectProofsForSpend, serializeOutputData, setEmitter, setOutputTraceId, settleDrainEvidence, shellQuoteArg, signDvmRequestData, signRequestData, signedRequestDomain, spendableAt, staleRateNotice, statusSnapshot, swapFeeForProofs, swapSendReserve, sweepPendingMelts, sweepPendingMints, sweepPendingSubmissions, sweepStaleInFlight, tempoBalanceCheckHint, tempoChannelControlledBy, tempoCredentialAmountMicro, tempoKeyImportRoutes, tempoSessionChallenge, tempoSessionChallengeMicro, tempoTokenReference, tempoWrongAssetHint, tierCapOverrides, toAgentProof, toFloatError, transportErrorCode, trustLadderFor, trustOverrideCapMicro, tryResolveBtcUsdRate, tryResolveTempoAsset, tryX402Payment, unreachableRailDisplay, unreachableRailHint, unrecordedFloatBudgetWarning, unsignRequestData, updateConfig, updateJob, usdToMsats, usdcToMsats, validateAgentMnemonic, validateLnAddress, validateX402Env, verifyCanonicalSignedRequest, verifyChallenge, verifyDrainReceiptChain, verifyFundingReceiptChain, verifyJobReceipt, verifyRouterFeedbackClaim, walletExists, weakestReceiptVerdict, windowStart, withIdentitiesLock, withInitRetry, withNwcPool, withTempoChannelLock, withTraceContext, withWalletLock, withX402ChannelLock, writeAgentMnemonic, x402ChannelBalanceUnreconciledAt, x402ChannelControlledBy, x402ChannelReservation, x402CreditChannelNetworks, x402CreditExactNetworks, x402ExactFundingDead, x402FlavourForInstrument, x402NetworkByCaip2, x402NetworkBySlug, x402NetworkLabel, x402NetworkListForCopy, x402PendingBlockExpiresAt, x402PendingDepositExpiresAt, x402PendingFundingJson, x402PendingRetired, x402PendingStale, x402PendingUnsettled, x402RequiredFromError, x402ReservationRelease, x402SupportedNetworksHint, x402VoucherPendingRefusal, x402WrongAssetHint };
|
package/dist/internal/caller.js
CHANGED
|
@@ -3454,7 +3454,36 @@ function planCreditForQuote(args) {
|
|
|
3454
3454
|
const canX402 = menu.funding.includes("x402") && args.x402Connected === true && offersX402CreditFunding(menu, args.x402Network);
|
|
3455
3455
|
const canMpp = menu.funding.includes("tempo") && args.tempoConnected === true && offersTempoCreditFunding(menu);
|
|
3456
3456
|
if (!canCashu && !canFloat && !canX402 && !canMpp) return none;
|
|
3457
|
-
if (args.
|
|
3457
|
+
if (!Number.isFinite(args.priceMsats) || args.priceMsats <= 0) return none;
|
|
3458
|
+
const stored = args.stored;
|
|
3459
|
+
if (stored?.reconciliationPending) return none;
|
|
3460
|
+
const refilling = stored?.status === "active" && stored.currency === menu.currency;
|
|
3461
|
+
const rateUnavailable = !Number.isFinite(args.btcRate) || args.btcRate <= 0;
|
|
3462
|
+
if (!refilling) {
|
|
3463
|
+
const completed = completedReceiptsFor(
|
|
3464
|
+
args.receipts,
|
|
3465
|
+
args.endpoint,
|
|
3466
|
+
args.signingPubkey,
|
|
3467
|
+
args.identity
|
|
3468
|
+
);
|
|
3469
|
+
if (completed.length === 0) return none;
|
|
3470
|
+
const identity = args.identity;
|
|
3471
|
+
if (rateUnavailable && identity && !completed.some((entry) => {
|
|
3472
|
+
const attested = attestedDvmIdentity(entry.builder);
|
|
3473
|
+
return attested?.dvmId === identity.dvmId && attested.builderPubkey === identity.builderPubkey;
|
|
3474
|
+
})) {
|
|
3475
|
+
return none;
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3478
|
+
if (rateUnavailable) {
|
|
3479
|
+
return posture === "auto" ? {
|
|
3480
|
+
mode: "none",
|
|
3481
|
+
fundingSkipped: {
|
|
3482
|
+
reason: "btc_rate_unavailable",
|
|
3483
|
+
operation: refilling ? "refill" : "open"
|
|
3484
|
+
}
|
|
3485
|
+
} : none;
|
|
3486
|
+
}
|
|
3458
3487
|
const priceMicro = msatsToMicro(args.priceMsats, args.btcRate);
|
|
3459
3488
|
if (priceMicro <= 0) return none;
|
|
3460
3489
|
const tier = trustTierFor({
|
|
@@ -3465,8 +3494,6 @@ function planCreditForQuote(args) {
|
|
|
3465
3494
|
menu,
|
|
3466
3495
|
...tierCapOverrides(args.config)
|
|
3467
3496
|
});
|
|
3468
|
-
const stored = args.stored;
|
|
3469
|
-
if (stored?.reconciliationPending) return none;
|
|
3470
3497
|
const targetJobs = targetJobsFor(args.config, args.endpoint, args.identity);
|
|
3471
3498
|
const pin = effectiveFundingRail(args.config, args.endpoint, args.identity);
|
|
3472
3499
|
const eligible = [
|
|
@@ -3501,7 +3528,7 @@ function planCreditForQuote(args) {
|
|
|
3501
3528
|
...forced ? { pinnedRail: forced.rail, pinnedRailSource: forced.source } : {}
|
|
3502
3529
|
}
|
|
3503
3530
|
});
|
|
3504
|
-
if (
|
|
3531
|
+
if (refilling) {
|
|
3505
3532
|
const targetMicro2 = refillTargetMicro({
|
|
3506
3533
|
menu,
|
|
3507
3534
|
priceMicro,
|
|
@@ -3536,9 +3563,6 @@ function planCreditForQuote(args) {
|
|
|
3536
3563
|
railReason: refillRoute.reason
|
|
3537
3564
|
};
|
|
3538
3565
|
}
|
|
3539
|
-
if (completedReceiptsFor(args.receipts, args.endpoint, args.signingPubkey, args.identity).length === 0) {
|
|
3540
|
-
return none;
|
|
3541
|
-
}
|
|
3542
3566
|
const fundMicro = sizeCreditMicro({
|
|
3543
3567
|
menu,
|
|
3544
3568
|
priceMicro,
|
|
@@ -3680,6 +3704,12 @@ function completedReceiptsFor(receipts, endpoint, signingPubkey, identity) {
|
|
|
3680
3704
|
if (normalizeCreditEndpoint(entry.endpoint) !== key || !mine(entry)) continue;
|
|
3681
3705
|
const verdict = verifyJobReceipt({ receipt: entry.receipt, builder: entry.builder });
|
|
3682
3706
|
if (verdict.status !== "verified" && verdict.status !== "verified_unattested") continue;
|
|
3707
|
+
if (identity !== void 0) {
|
|
3708
|
+
const attested = verdict.checks.attestation === "ok" ? attestedDvmIdentity(entry.builder) : void 0;
|
|
3709
|
+
if (attested?.dvmId !== identity.dvmId || attested.builderPubkey !== identity.builderPubkey) {
|
|
3710
|
+
continue;
|
|
3711
|
+
}
|
|
3712
|
+
}
|
|
3683
3713
|
here.push(entry);
|
|
3684
3714
|
if (anchor === void 0 && verdict.checks.attestation === "ok") {
|
|
3685
3715
|
anchor = attestedDvmIdentity(entry.builder);
|
|
@@ -6,8 +6,8 @@ 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 { A as AccumulatorPool, a as AccumulatorQuerier, C as ConsumedCredentialStore } from '../credit-menu-
|
|
10
|
-
export { b as AppEnv, c as CreditFundingReport, F as FiatDenomination, d as FiatDenominationFailure, e as FundOnlyRequest, I as IncomingPaymentOpts, J as JobCancelledError, M as MintHealthTracker, P as PAYMENT_PROOF_KEYS, f as PaymentErrorCode, g as PaymentErrorDetail, h as PaymentInfo, R as ReporterBannerOpts, i as ResolvedFx, j as RevenueBootCheckOpts, S as SDKServerOpts, k as ServerJob, l as ShortPayForfeit, T as TempoChannelReport, m as TempoObserverHealth, n as TempoSessionChannelMismatchError, U as UpfrontPaymentOpts, V as VerifiedIncomingPayment, o as VerifyIncomingSnapshot, X as X402BatchChannelObservation, p as X402FacilitatorHealth, q as X402SettlementEvidenceOutcome, r as X402SettlementRepair, s as X402SettlementRepairRefusal, t as X402SettlementRepaired, u as X402WedgedSettlement, v as X402WedgedSettlementPage, w as X402_BATCH_SETTLEMENT_MAINNET_NETWORK, x as abortJob, y as applyPaymentInfoToJob, z as assertRevenueReporterReady, B as buildPaymentErrorResponse, D as clearAccumulatorForDvm, E as createDVMServer, G as creditDepositPayload, H as derivedFundCreditId, K as devModeSkipsPaymentVerification, L as fromJobRecord, N as fundedMicroFor, O as hasPaymentProof, Q as hashLockKey, W as implicitCreditId, Y as initWalletAccumulatorTable, Z as insertAccumulatorRows, _ as isDerivedCreditId, $ as isTerminal, a0 as isYieldMessage, a1 as issueUpfrontChallenges, a2 as msatsToFiatMicro, a3 as paymentErrorBody, a4 as pinAskFiat, a5 as priceFiatMicro, a6 as processIncomingPayment, a7 as providerMessage, a8 as repairX402ExactSettlementEffect, a9 as resolveFxSnapshot, aa as resolvePriceFiat, ab as revenueReporterBannerState, ac as toCreditTerms, ad as toJobRecord, ae as unknownRouteNotFound, af as verifyIncomingPayment, ag as verifyTempoSessionManagementCredential, ah as verifyUpfrontPayment, ai as x402RequiredUsdcMicro, aj as x402SettledShare } from '../credit-menu-
|
|
9
|
+
import { A as AccumulatorPool, a as AccumulatorQuerier, C as ConsumedCredentialStore } from '../credit-menu-0-UtJ3hh.js';
|
|
10
|
+
export { b as AppEnv, c as CreditFundingReport, F as FiatDenomination, d as FiatDenominationFailure, e as FundOnlyRequest, I as IncomingPaymentOpts, J as JobCancelledError, M as MintHealthTracker, P as PAYMENT_PROOF_KEYS, f as PaymentErrorCode, g as PaymentErrorDetail, h as PaymentInfo, R as ReporterBannerOpts, i as ResolvedFx, j as RevenueBootCheckOpts, S as SDKServerOpts, k as ServerJob, l as ShortPayForfeit, T as TempoChannelReport, m as TempoObserverHealth, n as TempoSessionChannelMismatchError, U as UpfrontPaymentOpts, V as VerifiedIncomingPayment, o as VerifyIncomingSnapshot, X as X402BatchChannelObservation, p as X402FacilitatorHealth, q as X402SettlementEvidenceOutcome, r as X402SettlementRepair, s as X402SettlementRepairRefusal, t as X402SettlementRepaired, u as X402WedgedSettlement, v as X402WedgedSettlementPage, w as X402_BATCH_SETTLEMENT_MAINNET_NETWORK, x as abortJob, y as applyPaymentInfoToJob, z as assertRevenueReporterReady, B as buildPaymentErrorResponse, D as clearAccumulatorForDvm, E as createDVMServer, G as creditDepositPayload, H as derivedFundCreditId, K as devModeSkipsPaymentVerification, L as fromJobRecord, N as fundedMicroFor, O as hasPaymentProof, Q as hashLockKey, W as implicitCreditId, Y as initWalletAccumulatorTable, Z as insertAccumulatorRows, _ as isDerivedCreditId, $ as isTerminal, a0 as isYieldMessage, a1 as issueUpfrontChallenges, a2 as msatsToFiatMicro, a3 as paymentErrorBody, a4 as pinAskFiat, a5 as priceFiatMicro, a6 as processIncomingPayment, a7 as providerMessage, a8 as repairX402ExactSettlementEffect, a9 as resolveFxSnapshot, aa as resolvePriceFiat, ab as revenueReporterBannerState, ac as toCreditTerms, ad as toJobRecord, ae as unknownRouteNotFound, af as verifyIncomingPayment, ag as verifyTempoSessionManagementCredential, ah as verifyUpfrontPayment, ai as x402RequiredUsdcMicro, aj as x402SettledShare } from '../credit-menu-0-UtJ3hh.js';
|
|
11
11
|
import { g as LockPubkey } from '../lightning-backend-BhsyrBLa.js';
|
|
12
12
|
export { t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-BhsyrBLa.js';
|
|
13
13
|
export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-D3CcZp_g.js';
|
package/dist/internal/server.js
CHANGED
package/dist/server/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ab as CashuMode, bK as CreditDrainEnqueue, R as ResolvedCreditConfig, bL as DVMAuthScheme, z as SignedRequestDomain, bM as CreditLedgerLike, bN as X402RefundSettlementGate, bO as CreditSnapshot, bP as DrawResult, bQ as X402SettlementStatus, bR as X402UnresolvedRefund, bS as GrownDrawResult, bT as DrawResolution, bU as FundingRecord, X as FundingReceipt, bV as CreditInvoiceRecord, bW as InvoiceSettlement, bX as BlockedInvoiceCursor, bY as InvoiceReconciliation, bZ as InvoiceWriteOff, b_ as DrawRecord, b$ as StalePendingDrawCursor, c0 as TempoCreditLossEvidence, c1 as CreditLedgerQuerier, c2 as TempoCreditLoss, c3 as X402CreditLossEvidence, c4 as X402CreditLoss, c5 as DrainMethod, c6 as DrainRequestResult, c7 as BitcoinDepositLiability, bo as FundingLot, c8 as CreditDrainRecord, c9 as ChannelDrainCursor, ca as DrainWriteOff, cb as DrainReleaseResult, cc as DrainFulfilment, cd as DrainTransitionResult, Y as JobReceipt, a1 as Message, K as KVStore, F as SignedRequestReplayStore, Z as ZodLike, a as DVMDescriptor } from '../step-cache-v2yhyhSZ.js';
|
|
2
2
|
export { ce as CLIENT_COMPATIBILITY_HEADERS, d as CanonicalEnvelope, cf as ClientCompatibility, cg as ClientCompatibilityEnv, ch as ClientCompatibilityGate, ci as ClientCompatibilityRequirement, cj as ClientSemVer, e as CreateSignedRequestVerifierOpts, ck as CreditFundingBasis, cl as CreditInvoiceStatus, cm as CreditLedger, cn as CreditLedgerError, co as CreditLedgerErrorCode, cp as CreditLedgerErrorDetails, cq as CreditLedgerPool, cr as CreditStatus, cs as DRAIN_DELIVERY_RESERVE_SATS, ct as DVM_PROTOCOL_VERSION, cu as DrainConflictReason, cv as DrawRailValue, cw as DrawStatus, cx as JobCostReportPayload, cy as JobTerminalReportPayload, cz as PostgresX402ChannelStorage, cA as ReplayStoreBackend, cB as RevenueSkippedNoRailPayload, cC as RevenueSkippedNoRailReason, w as SIGNED_REQUEST_AUTH_ID, x as SIGNED_REQUEST_STATEMENT_VERSION, cD as Secp256k1AuthOpts, y as SignedRequestAudience, B as SignedRequestError, E as SignedRequestFailure, G as SignedRequestSignOpts, H as SignedRequestStatementHeader, M as SignedRequestVerifier, cE as X402ChannelStorageOpts, cF as X402RelayLockHolder, cG as X402RelaySubmissionLock, cH as X402RelaySubmissionLockError, cI as allocateDrawValue, cJ as clientCompatibilityAttributes, cK as clientCompatibilityMiddleware, cL as clientUpgradeRequired, N as createSignedRequestVerifier, cM as parseClientCapabilities, cN as parseClientCompatibility, cO as parseDvmClient, cP as parseProtocolVersion, cQ as requireClientCompatibility, cR as secp256k1Auth, cS as signedRequestInput, T as signedRequestStatementHeader } from '../step-cache-v2yhyhSZ.js';
|
|
3
3
|
import { Pool } from 'pg';
|
|
4
|
-
import { ak as CreditMenu, b as AppEnv, U as UpfrontPaymentOpts, h as PaymentInfo, al as ReceiptIssuer, am as LightningReceive, an as TempoSettlementReadiness, ao as DVMHostOpts, ap as DVMServeResult } from '../credit-menu-
|
|
5
|
-
export { aq as BuildCreditMenuArgs, ar as BuilderIdentity, as as CREDIT_ENVELOPE_KEYS, C as ConsumedCredentialStore, at as CreateX402BatchSettlementServerOpts, au as CreditEnvelope, av as CreditEnvelopeError, aw as CreditFundCommitment, ax as CreditTerms, ay as DEFAULT_INVOICE_TTL_SECONDS, az as DVMHost, aA as HostingControlCommand, aB as HostingControlConfig, aC as HostingControlStatus, aD as JobManager, aE as JobManagerOpts, aF as LightningReceiveConfig, aG as MIN_INVOICE_TTL_SECONDS, aH as MemoryConsumedCredentialStore, aI as MemoryConsumedCredentialStoreOpts, aJ as MemoryProcessedPaymentStore, aK as MemoryX402ExactSettlementStore, aL as MountOpts, aM as OwnerDisplay, aN as PaidJobCompletion, aO as PaymentMode, aP as PlatformReporterOpts, aQ as PostgresProcessedPaymentStore, aR as PostgresX402ExactSettlementStore, aS as PriceFiat, aT as ProcessedPaymentQuerier, aU as ProcessedPaymentRail, aV as ProcessedPaymentRecord, aW as ProcessedPaymentReplayError, aX as ProcessedPaymentStore, aY as X402BatchAcceptance, aZ as X402BatchFunding, a_ as X402BatchRefusal, a$ as X402BatchSettlementServer, b0 as X402ExactAcceptance, b1 as X402ExactIntentConflictError, b2 as X402ExactSettlementAttempt, b3 as X402ExactSettlementChainEvidence, b4 as X402ExactSettlementEffect, b5 as X402ExactSettlementEvidenceMissingError, b6 as X402ExactSettlementEvidenceReader, b7 as X402ExactSettlementIntent, b8 as X402ExactSettlementNotReadyError, b9 as X402ExactSettlementServer, ba as X402ExactSettlementServerOpts, bb as X402ExactSettlementStatus, bc as X402ExactSettlementStore, bd as X402SettlementChainEvidence, be as X402SettlementEvidenceReader, bf as X402SettlementSubmissionError, bg as X402_BATCH_AUTO_SETTLEMENT, bh as X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS, bi as X402_BATCH_SETTLEMENT_NETWORK, bj as attachCreditMenu, bk as buildCreditMenu, bl as createDVMHost, bm as createX402BatchSettlementServer, bn as creditEnvelopeIgnoreFields, bo as drawSettlementRef, bp as extractCreditEnvelope, bq as fundingCommitment, br as selectPrimaryCredit, bs as signHostingControl, bt as stripCreditEnvelope, bu as toCreditView } from '../credit-menu-
|
|
4
|
+
import { ak as CreditMenu, b as AppEnv, U as UpfrontPaymentOpts, h as PaymentInfo, al as ReceiptIssuer, am as LightningReceive, an as TempoSettlementReadiness, ao as DVMHostOpts, ap as DVMServeResult } from '../credit-menu-0-UtJ3hh.js';
|
|
5
|
+
export { aq as BuildCreditMenuArgs, ar as BuilderIdentity, as as CREDIT_ENVELOPE_KEYS, C as ConsumedCredentialStore, at as CreateX402BatchSettlementServerOpts, au as CreditEnvelope, av as CreditEnvelopeError, aw as CreditFundCommitment, ax as CreditTerms, ay as DEFAULT_INVOICE_TTL_SECONDS, az as DVMHost, aA as HostingControlCommand, aB as HostingControlConfig, aC as HostingControlStatus, aD as JobManager, aE as JobManagerOpts, aF as LightningReceiveConfig, aG as MIN_INVOICE_TTL_SECONDS, aH as MemoryConsumedCredentialStore, aI as MemoryConsumedCredentialStoreOpts, aJ as MemoryProcessedPaymentStore, aK as MemoryX402ExactSettlementStore, aL as MountOpts, aM as OwnerDisplay, aN as PaidJobCompletion, aO as PaymentMode, aP as PlatformReporterOpts, aQ as PostgresProcessedPaymentStore, aR as PostgresX402ExactSettlementStore, aS as PriceFiat, aT as ProcessedPaymentQuerier, aU as ProcessedPaymentRail, aV as ProcessedPaymentRecord, aW as ProcessedPaymentReplayError, aX as ProcessedPaymentStore, aY as X402BatchAcceptance, aZ as X402BatchFunding, a_ as X402BatchRefusal, a$ as X402BatchSettlementServer, b0 as X402ExactAcceptance, b1 as X402ExactIntentConflictError, b2 as X402ExactSettlementAttempt, b3 as X402ExactSettlementChainEvidence, b4 as X402ExactSettlementEffect, b5 as X402ExactSettlementEvidenceMissingError, b6 as X402ExactSettlementEvidenceReader, b7 as X402ExactSettlementIntent, b8 as X402ExactSettlementNotReadyError, b9 as X402ExactSettlementServer, ba as X402ExactSettlementServerOpts, bb as X402ExactSettlementStatus, bc as X402ExactSettlementStore, bd as X402SettlementChainEvidence, be as X402SettlementEvidenceReader, bf as X402SettlementSubmissionError, bg as X402_BATCH_AUTO_SETTLEMENT, bh as X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS, bi as X402_BATCH_SETTLEMENT_NETWORK, bj as attachCreditMenu, bk as buildCreditMenu, bl as createDVMHost, bm as createX402BatchSettlementServer, bn as creditEnvelopeIgnoreFields, bo as drawSettlementRef, bp as extractCreditEnvelope, bq as fundingCommitment, br as selectPrimaryCredit, bs as signHostingControl, bt as stripCreditEnvelope, bu as toCreditView } from '../credit-menu-0-UtJ3hh.js';
|
|
6
6
|
import { Context } from 'hono';
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import { F as FxFetcher } from '../fx-DhyT1Cjh.js';
|
package/dist/server/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dvmkit/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1-rc.10",
|
|
4
4
|
"description": "SDK for building accountless, pay-per-use Digital Vending Machines",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"mppx": "0.8.15",
|
|
78
78
|
"nostr-tools": "2.23.3",
|
|
79
79
|
"proper-lockfile": "4.1.2",
|
|
80
|
-
"undici": "7.29.
|
|
80
|
+
"undici": "7.29.1",
|
|
81
81
|
"ws": "8.21.0",
|
|
82
82
|
"zod": "4.4.3"
|
|
83
83
|
},
|