@t2000/cli 10.30.4 → 10.30.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -36361,12 +36361,29 @@ async function loadSpecText(input) {
36361
36361
  }
36362
36362
  return { kind: "text", text };
36363
36363
  }
36364
+ async function putAndVerifySpec(base, content) {
36365
+ const hash = await putJobSpec(base, content);
36366
+ let roundTrip;
36367
+ try {
36368
+ roundTrip = await getJobSpec(base, hash);
36369
+ } catch (e) {
36370
+ throw new Error(
36371
+ `The content store accepted the upload but could not serve it back (${e instanceof Error ? e.message : "read failed"}) \u2014 nothing was pinned on-chain. Retry in a moment.`
36372
+ );
36373
+ }
36374
+ if (roundTrip !== content) {
36375
+ throw new Error(
36376
+ "The content store returned different bytes than were uploaded \u2014 nothing was pinned on-chain. Retry in a moment."
36377
+ );
36378
+ }
36379
+ return hash;
36380
+ }
36364
36381
  async function resolveSpecUpload(base, input) {
36365
36382
  const loaded = await loadSpecText(input);
36366
36383
  if (loaded.kind === "hash") {
36367
36384
  return { hash: loaded.hash, uploaded: false };
36368
36385
  }
36369
- return { hash: `0x${await putJobSpec(base, loaded.text)}`, uploaded: true };
36386
+ return { hash: `0x${await putAndVerifySpec(base, loaded.text)}`, uploaded: true };
36370
36387
  }
36371
36388
  async function resolveHireSpecUpload(base, input, title) {
36372
36389
  const loaded = await loadSpecText(input);
@@ -36379,7 +36396,7 @@ async function resolveHireSpecUpload(base, input, title) {
36379
36396
  "The brief plus its envelope exceeds the 16 KiB job-spec store cap \u2014 shorten the brief, or link the long artifact (URL / IPFS)."
36380
36397
  );
36381
36398
  }
36382
- return { hash: `0x${await putJobSpec(base, body2)}`, uploaded: true };
36399
+ return { hash: `0x${await putAndVerifySpec(base, body2)}`, uploaded: true };
36383
36400
  }
36384
36401
  function stateColor(state) {
36385
36402
  if (state === "released") return import_picocolors13.default.green(state);
@@ -36680,7 +36697,7 @@ no fund step; unclaimed openings refund fee-free):
36680
36697
  buyer,
36681
36698
  createdAtMs: Date.now()
36682
36699
  });
36683
- specHash = `0x${await putJobSpec(base, spec)}`;
36700
+ specHash = `0x${await putAndVerifySpec(base, spec)}`;
36684
36701
  amountUsdc = service.priceUsdc;
36685
36702
  seller = service.agent;
36686
36703
  deliverByMs = Date.now() + service.slaMinutes * 6e4;