@t2000/cli 10.13.2 → 10.13.3

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.
@@ -193,7 +193,7 @@ import {
193
193
  verifyReceipt,
194
194
  walletExists,
195
195
  writeLimitsFile
196
- } from "./chunk-XYBAD4N6.js";
196
+ } from "./chunk-M3VP3LAY.js";
197
197
  import "./chunk-634W6JCI.js";
198
198
  import "./chunk-3ZUWXUSN.js";
199
199
  import "./chunk-QSITA6GU.js";
@@ -401,4 +401,4 @@ export {
401
401
  walletExists,
402
402
  writeLimitsFile
403
403
  };
404
- //# sourceMappingURL=dist-DC323R52.js.map
404
+ //# sourceMappingURL=dist-4BBYOHH2.js.map
@@ -144190,8 +144190,9 @@ async function payWithMpp(args) {
144190
144190
  if (probe.status !== 402) {
144191
144191
  return finalize2(probe, { paid: false });
144192
144192
  }
144193
- const requirements = await pickSuiExactRequirements(probe, client.network);
144194
- if (requirements) {
144193
+ const pick4 = await pickSuiExactRequirements(probe, client.network);
144194
+ if (pick4.kind === "payable") {
144195
+ const requirements = pick4.requirements;
144195
144196
  const { isX402EscrowRequirements: isX402EscrowRequirements2 } = await Promise.resolve().then(() => (init_x402(), x402_exports));
144196
144197
  if (isX402EscrowRequirements2(requirements)) {
144197
144198
  const escrow = requirements.extra.escrow;
@@ -144224,6 +144225,13 @@ async function payWithMpp(args) {
144224
144225
  await reportDirectPayment(result, options.url);
144225
144226
  return result;
144226
144227
  }
144228
+ if (pick4.kind === "incomplete") {
144229
+ throw new T2000Error(
144230
+ "FACILITATOR_REJECTION",
144231
+ "Seller's x402 challenge is incomplete (missing extra.suimpp) \u2014 nothing was paid. The 402 advertises an exact/sui entry but carries no settlement challenge to bind a payment to; the seller must emit the createX402Requirements shape to be x402-payable.",
144232
+ { reason: "incomplete-x402-accepts" }
144233
+ );
144234
+ }
144227
144235
  throw new T2000Error(
144228
144236
  "FACILITATOR_REJECTION",
144229
144237
  `Endpoint returned 402 without an x402 'exact' / sui:${client.network} requirement in the body or an MPP 'sui' challenge in WWW-Authenticate. Nothing this SDK can pay.`
@@ -144262,17 +144270,34 @@ async function parseMppSuiChallenge(response) {
144262
144270
  return void 0;
144263
144271
  }
144264
144272
  }
144273
+ function hasCompleteSuimppChallenge(entry) {
144274
+ const s = entry.extra?.suimpp;
144275
+ return !!s && typeof s.challengeId === "string" && s.challengeId.length > 0 && typeof s.nonce === "number" && typeof s.chain === "string" && s.chain.length > 0 && typeof s.minEpoch === "string" && typeof s.maxEpoch === "string";
144276
+ }
144265
144277
  async function pickSuiExactRequirements(response, network) {
144266
144278
  try {
144267
144279
  const body2 = await response.clone().json();
144268
144280
  const want = `sui:${network === "testnet" ? "testnet" : "mainnet"}`;
144269
- return body2.accepts?.find((a) => a.scheme === "exact" && a.network === want);
144281
+ const entry = body2.accepts?.find((a) => a.scheme === "exact" && a.network === want);
144282
+ if (!entry) return { kind: "none" };
144283
+ const { isX402EscrowRequirements: isX402EscrowRequirements2 } = await Promise.resolve().then(() => (init_x402(), x402_exports));
144284
+ if (hasCompleteSuimppChallenge(entry) || isX402EscrowRequirements2(entry)) {
144285
+ return { kind: "payable", requirements: entry };
144286
+ }
144287
+ return { kind: "incomplete" };
144270
144288
  } catch {
144271
- return void 0;
144289
+ return { kind: "none" };
144272
144290
  }
144273
144291
  }
144274
144292
  async function payViaX402(args) {
144275
144293
  const { signer, client, options, reqInit, requirements } = args;
144294
+ if (!hasCompleteSuimppChallenge(requirements)) {
144295
+ throw new T2000Error(
144296
+ "FACILITATOR_REJECTION",
144297
+ "Seller's x402 challenge is incomplete (missing extra.suimpp) \u2014 nothing was paid.",
144298
+ { reason: "incomplete-x402-accepts" }
144299
+ );
144300
+ }
144276
144301
  const { buildX402SignedPayment: buildX402SignedPayment2, X402_PAYMENT_HEADER: X402_PAYMENT_HEADER2, X402_PAYMENT_RESPONSE_HEADER: X402_PAYMENT_RESPONSE_HEADER2 } = await Promise.resolve().then(() => (init_x402(), x402_exports));
144277
144302
  const amountRaw = BigInt(requirements.maxAmountRequired);
144278
144303
  assertWithinMaxPrice(atomicToHuman(amountRaw, await assetDecimals(requirements.asset)), options.maxPrice);
@@ -147275,7 +147300,7 @@ CRITICAL: When the user asks to use any external or paid API, names a provider (
147275
147300
  The wallet also trades on the t2 AGENT ECONOMY (agents.t2000.ai). It can HIRE other agents: browse structured fixed-price agent services with t2000_browse, fund an on-chain USDC escrow job with t2000_job_create, track it with t2000_jobs, settle with t2000_job_settle, and rate the seller with t2000_job_review (escrow protects both sides \u2014 no delivery means an automatic refund path). It can EARN too: list what THIS agent sells with t2000_service_create (no server or endpoint needed), watch incoming jobs with t2000_jobs (role: seller), and deliver with t2000_job_deliver \u2014 the escrow pays this wallet on release.
147276
147301
 
147277
147302
  Spending is the user's own USDC and every t2000_pay call is bounded by maxPrice; t2000_job_create locks the listed service price in escrow. For larger or multi-step spends, state the estimated cost first and proceed once the user is happy. Use t2000_balance to check funds. The v4 wallet is payments-only \u2014 there is no savings / lending surface.`;
147278
- var PKG_VERSION = "10.13.2";
147303
+ var PKG_VERSION = "10.13.3";
147279
147304
  console.log = (...args) => console.error("[log]", ...args);
147280
147305
  console.warn = (...args) => console.error("[warn]", ...args);
147281
147306
  async function startMcpServer(opts) {
@@ -147361,4 +147386,4 @@ mime-types/index.js:
147361
147386
  @scure/bip39/index.js:
147362
147387
  (*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
147363
147388
  */
147364
- //# sourceMappingURL=dist-NPHL44A3.js.map
147389
+ //# sourceMappingURL=dist-QEBZPEX3.js.map