@capxul/mcp 2.7.0 → 2.8.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.
Files changed (2) hide show
  1. package/dist/main.mjs +98 -7
  2. package/package.json +3 -3
package/dist/main.mjs CHANGED
@@ -240,7 +240,7 @@ function normalizeEmail(email) {
240
240
  }
241
241
  //#endregion
242
242
  //#region package.json
243
- var version$2 = "2.7.0";
243
+ var version$2 = "2.8.0";
244
244
  //#endregion
245
245
  //#region ../../packages/errors/src/chain-cause.ts
246
246
  /**
@@ -364,6 +364,69 @@ function chainCauseProperties(chain) {
364
364
  };
365
365
  }
366
366
  /**
367
+ * Safe (safe-contracts v1.4.1) revert codes. The contracts revert with these
368
+ * short strings to save gas; the sentence lives in the Safe docs
369
+ * (`docs/error_codes.md`). Every Safe on the Capxul rail is this version.
370
+ */
371
+ const SAFE_REVERT_REASONS = {
372
+ GS000: "could not finish initialization",
373
+ GS001: "threshold needs to be defined",
374
+ GS010: "not enough gas to execute Safe transaction",
375
+ GS011: "could not pay gas costs with ether",
376
+ GS012: "could not pay gas costs with token",
377
+ GS013: "Safe transaction failed when gasPrice and safeTxGas were 0",
378
+ GS020: "signatures data too short",
379
+ GS021: "invalid contract signature location: inside static part",
380
+ GS022: "invalid contract signature location: length not present",
381
+ GS023: "invalid contract signature location: data not complete",
382
+ GS024: "invalid contract signature provided",
383
+ GS025: "hash has not been approved",
384
+ GS026: "invalid owner provided",
385
+ GS030: "only owners can approve a hash",
386
+ GS031: "method can only be called from this contract",
387
+ GS100: "modules have already been initialized",
388
+ GS101: "invalid module address provided",
389
+ GS102: "module has already been added",
390
+ GS103: "invalid prevModule, module pair provided",
391
+ GS104: "method can only be called from an enabled module",
392
+ GS105: "invalid starting point for fetching paginated modules",
393
+ GS106: "invalid page size for fetching paginated modules",
394
+ GS200: "owners have already been set up",
395
+ GS201: "threshold cannot exceed owner count",
396
+ GS202: "threshold needs to be greater than 0",
397
+ GS203: "invalid owner address provided",
398
+ GS204: "address is already an owner",
399
+ GS205: "invalid prevOwner, owner pair provided",
400
+ GS300: "guard does not implement IERC165",
401
+ GS400: "fallback handler cannot be set to self"
402
+ };
403
+ /**
404
+ * `Error(GS205: invalid prevOwner, owner pair provided)`, or the bare selector
405
+ * when the name is unknown. Safe codes travel only as the `message` of an
406
+ * `Error(string)` revert, so only that argument is expanded from
407
+ * {@link SAFE_REVERT_REASONS}; every other argument reads `name=value`, even
408
+ * when a custom error's field happens to hold a `GS` string.
409
+ */
410
+ function revertSummaryText(revert) {
411
+ if (revert.name === null) return revert.selector === "0x" ? "empty revert" : `unknown selector ${revert.selector}`;
412
+ const args = Object.entries(revert.args).map(([name, value]) => {
413
+ const reason = revert.name === "Error" && name === "message" ? SAFE_REVERT_REASONS[value] : void 0;
414
+ return reason === void 0 ? `${name}=${value}` : `${value}: ${reason}`;
415
+ }).join(", ");
416
+ return `${revert.name}(${args})`;
417
+ }
418
+ /**
419
+ * The cause in one line for an issue description: the decoded revert first,
420
+ * because the provider's own message masks the raw revert data (`reason:
421
+ * [REDACTED]`), then the provider's words. `undefined` when the cause carries
422
+ * neither, so the caller falls back to the error message.
423
+ */
424
+ function chainCauseSummary(chain) {
425
+ const revert = chain.revert === void 0 ? void 0 : revertSummaryText(chain.revert);
426
+ if (revert === void 0) return chain.providerMessage;
427
+ return chain.providerMessage === void 0 ? revert : `${revert}; ${chain.providerMessage}`;
428
+ }
429
+ /**
367
430
  * The error-tracking fingerprint for a failure: the code, the one-word cause,
368
431
  * and the operation. PostHog groups `$exception` rows by this value, so one
369
432
  * issue is one cause at one operation instead of every provider failure in
@@ -381,6 +444,7 @@ const CAPXUL_ERROR_CODES = [
381
444
  "SMART_ACCOUNT_MISSING",
382
445
  "PLAYER_NOT_FOUND",
383
446
  "ACCOUNT_NOT_FOUND",
447
+ "ACCOUNT_CLAIMED_BY_OTHER_SIGNER",
384
448
  "PROVIDER_ERROR",
385
449
  "CAPABILITY_UNAVAILABLE",
386
450
  "INVALID_INPUT",
@@ -480,6 +544,14 @@ const Errors = {
480
544
  smartAccountMissing: (authUserId) => new CapxulError("SMART_ACCOUNT_MISSING", "Smart account not provisioned", { details: { authUserId } }),
481
545
  playerNotFound: (playerId) => new CapxulError("PLAYER_NOT_FOUND", playerId ? `Openfort player ${playerId} not found` : "Openfort player not found", playerId === void 0 ? void 0 : { details: { playerId } }),
482
546
  accountNotFound: (accountId) => new CapxulError("ACCOUNT_NOT_FOUND", accountId ? `Openfort account ${accountId} not found` : "Openfort account not found", accountId === void 0 ? void 0 : { details: { accountId } }),
547
+ /**
548
+ * The Safe at this email's address is deployed and its owner is neither the
549
+ * Capxul bootstrap owner nor the caller's signer. The claim
550
+ * `swapOwner(bootstrap → signer)` cannot succeed: only the on-chain owner
551
+ * can hand the account over. Read from `getOwners()` before any
552
+ * UserOperation is built (2026-09-02), so no simulation and no retry.
553
+ */
554
+ accountClaimedByOtherSigner: (details) => new CapxulError("ACCOUNT_CLAIMED_BY_OTHER_SIGNER", "This account is already owned by a different signer.", { details }),
483
555
  providerError: (provider, operation, cause, opts) => {
484
556
  const details = {
485
557
  ...opts?.details,
@@ -5778,11 +5850,27 @@ var PendingAuthStore = class {
5778
5850
  //#region ../../packages/sdk/src/domain/identity/model.ts
5779
5851
  const WRONG = { refused: "WRONG_STATE" };
5780
5852
  /** org-lifecycle.ts:173-184, lifted verbatim. */
5853
+ /**
5854
+ * Causes that do not change on a retry: the same request reverts, is refused,
5855
+ * or fails the same pre-flight again. A retry re-enters the same lane and
5856
+ * fails the same way (the GS205 loop of 2026-09-02).
5857
+ */
5858
+ const DEFINITIVE_PROVIDER_MODES = /* @__PURE__ */ new Set([
5859
+ "auth-origin-mismatch",
5860
+ "app-env-allowlist",
5861
+ "no-secure-context",
5862
+ "revert",
5863
+ "insufficient-balance",
5864
+ "insufficient-allowance",
5865
+ "rejected",
5866
+ "unauthorized"
5867
+ ]);
5781
5868
  const isRetryable = (failure) => {
5782
5869
  if (failure.code === "CANCELLED" || failure.code === "SIGNER_REJECTED") return true;
5783
5870
  if (failure.code === "PROVIDER_ERROR") {
5784
- const mode = failure.mode;
5785
- return mode !== "auth-origin-mismatch" && mode !== "app-env-allowlist" && mode !== "no-secure-context";
5871
+ const chainRetryable = failure.error?.chain?.retryable;
5872
+ if (chainRetryable !== void 0) return chainRetryable;
5873
+ return !DEFINITIVE_PROVIDER_MODES.has(failure.mode);
5786
5874
  }
5787
5875
  return failure.code === "NETWORK_ERROR" || failure.code === "UNKNOWN";
5788
5876
  };
@@ -8554,7 +8642,7 @@ const moneyExecutionContract = {
8554
8642
  };
8555
8643
  //#endregion
8556
8644
  //#region ../../packages/sdk/package.json
8557
- var version = "2.7.0";
8645
+ var version = "2.8.0";
8558
8646
  //#endregion
8559
8647
  //#region ../../packages/sdk/src/telemetry/capture-exception.ts
8560
8648
  /** Fixed, leak-safe message — the raw error message may carry PII and never ships. */
@@ -8833,12 +8921,13 @@ function sanitizeChainDetail(source, detail) {
8833
8921
  for (const key of [
8834
8922
  "chain_upstream",
8835
8923
  "chain_method",
8836
- "chain_revert_name",
8837
- "chain_revert_selector"
8924
+ "chain_revert_name"
8838
8925
  ]) {
8839
8926
  const value = source[key];
8840
8927
  if (typeof value === "string" && ENUMERATED_DETAIL_RE.test(value)) detail[key] = value;
8841
8928
  }
8929
+ const selector = source.chain_revert_selector;
8930
+ if (typeof selector === "string" && REVERT_SELECTOR_RE.test(selector)) detail.chain_revert_selector = selector;
8842
8931
  if (typeof source.chain_retryable === "boolean") detail.chain_retryable = source.chain_retryable;
8843
8932
  const chainHttpStatus = source.chain_http_status;
8844
8933
  if (typeof chainHttpStatus === "number" && Number.isInteger(chainHttpStatus) && chainHttpStatus >= 100 && chainHttpStatus <= 599) detail.chain_http_status = chainHttpStatus;
@@ -8864,6 +8953,8 @@ function sanitizeFailureDetail(input) {
8864
8953
  }
8865
8954
  /** Enumerated codes only (`convex`, `no-secure-context`, `bootstrap-encode`); free text fails. */
8866
8955
  const ENUMERATED_DETAIL_RE = /^[A-Za-z][A-Za-z0-9_.-]{0,63}$/u;
8956
+ /** A four-byte revert selector, or the bare `0x` of an empty revert. */
8957
+ const REVERT_SELECTOR_RE = /^0x(?:[0-9a-fA-F]{8})?$/u;
8867
8958
  function normalizeOperation$1(value) {
8868
8959
  return typeof value === "string" && /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,255}$/u.test(value) ? value : "unknown";
8869
8960
  }
@@ -44852,7 +44943,7 @@ async function postServerException(error, errorKind, operation, properties, cont
44852
44943
  $exception_level: "error",
44853
44944
  $exception_fingerprint: failureFingerprint(errorKind, mode, operation),
44854
44945
  $issue_name: issueName(errorKind, mode, chain, operation),
44855
- $issue_description: safeText(chain?.providerMessage ?? message),
44946
+ $issue_description: safeText((chain === void 0 ? void 0 : chainCauseSummary(chain)) ?? message),
44856
44947
  $exception_list: [{
44857
44948
  type: errorKind,
44858
44949
  value: message,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/mcp",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "private": false,
5
5
  "description": "Capxul MCP server for auth, Account readiness, identity, Organizations, relationships, requests, destinations, and testnet funding over Streamable HTTP.",
6
6
  "keywords": [
@@ -47,9 +47,9 @@
47
47
  "typescript": "npm:@typescript/typescript6@6.0.2",
48
48
  "vite": "npm:@voidzero-dev/vite-plus-core@0.3.0",
49
49
  "vite-plus": "0.3.0",
50
- "@capxul/backend": "0.2.15",
50
+ "@capxul/backend": "0.2.16",
51
51
  "@capxul/config": "0.2.1",
52
- "@capxul/sdk": "2.7.0",
52
+ "@capxul/sdk": "2.8.0",
53
53
  "@capxul/types": "0.2.1",
54
54
  "@capxul/typescript-config": "0.0.0",
55
55
  "@capxul/wire": "0.5.1"