@dvmkit/sdk 0.20.0 → 0.21.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.
@@ -18479,6 +18479,16 @@ function waitForInlineResult(store, jobId, localJob, seconds, signal) {
18479
18479
  notify();
18480
18480
  });
18481
18481
  }
18482
+ var INLINE_RESULT_MESSAGES_MAX_BYTES = 1048576;
18483
+ async function inlineResultMessages(store, job) {
18484
+ if (job.status !== "completed" || job.redactedAt !== void 0 || !job.messages.some((message) => message.type === "artifact")) return void 0;
18485
+ let messages = job.messages.filter((message) => message.seq > 0);
18486
+ if (isStreamableJobStore(store)) {
18487
+ const durable = await store.getMessages(job.id, 0, { includeHeld: true });
18488
+ if (durable.length > 0) messages = durable;
18489
+ }
18490
+ return Buffer.byteLength(JSON.stringify(messages), "utf8") <= INLINE_RESULT_MESSAGES_MAX_BYTES ? messages : void 0;
18491
+ }
18482
18492
 
18483
18493
  // src/sdk/server/job-read-response.ts
18484
18494
  async function withJobReadAvailability(read) {
@@ -24691,7 +24701,8 @@ var DVMServer = class {
24691
24701
  return snapshot;
24692
24702
  }
24693
24703
  async submitResponse(c, job, jobToken) {
24694
- if (job.paymentRail === "cashu" && job.paymentTxHash?.startsWith(DERIVED_REQUEST_ID_PREFIX) && !job.requesterPubkey && c.req.header("X-Cashu") && !c.req.header("X-Cashu-Request-Id")) {
24704
+ const inlineResult = job.paymentRail === "cashu" && job.paymentTxHash?.startsWith(DERIVED_REQUEST_ID_PREFIX) && !job.requesterPubkey && c.req.header("X-Cashu") && !c.req.header("X-Cashu-Request-Id");
24705
+ if (inlineResult) {
24695
24706
  await waitForInlineResult(
24696
24707
  this.jobManager.store,
24697
24708
  job.id,
@@ -24701,7 +24712,10 @@ var DVMServer = class {
24701
24712
  );
24702
24713
  }
24703
24714
  const snapshot = await this.readJobSnapshot(job, !("listeners" in job));
24704
- return buildSubmitResponse(c, snapshot, jobToken, await this.contentFields(snapshot));
24715
+ const messages = inlineResult ? await inlineResultMessages(this.jobManager.store, snapshot) : void 0;
24716
+ const fields = await this.contentFields(snapshot);
24717
+ if (messages && fields.content_available !== false) fields.messages = messages;
24718
+ return buildSubmitResponse(c, snapshot, jobToken, fields);
24705
24719
  }
24706
24720
  async contentFields(job) {
24707
24721
  const store = this.jobManager.store;
@@ -61,7 +61,7 @@ import {
61
61
  verifyUpfrontPayment,
62
62
  x402RequiredUsdcMicro,
63
63
  x402SettledShare
64
- } from "../chunk-NWOSJFZX.js";
64
+ } from "../chunk-VT3WUX6B.js";
65
65
  import "../chunk-XRLKGCAW.js";
66
66
  import {
67
67
  PayoutReporter
@@ -82,7 +82,7 @@ import {
82
82
  toCreditView,
83
83
  unknownRouteNotFound,
84
84
  writeOffHostedTempoCloseReport
85
- } from "../chunk-NWOSJFZX.js";
85
+ } from "../chunk-VT3WUX6B.js";
86
86
  import {
87
87
  MemoryProcessedPaymentStore,
88
88
  PostgresProcessedPaymentStore,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvmkit/sdk",
3
- "version": "0.20.0",
3
+ "version": "0.21.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": [