@capxul/mcp 2.5.3 → 2.5.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.
Files changed (2) hide show
  1. package/dist/main.mjs +507 -95
  2. package/package.json +5 -5
package/dist/main.mjs CHANGED
@@ -7,7 +7,7 @@ import { createHash, randomBytes } from "node:crypto";
7
7
  import { createServer } from "node:http";
8
8
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
9
9
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
10
- import { concat, concatHex, createPublicClient, createWalletClient, custom, decodeAbiParameters, decodeFunctionData, decodeFunctionResult, encodeAbiParameters, encodeFunctionData, encodePacked, formatUnits, getAddress, getContractAddress, hashMessage, hashTypedData, hexToBigInt, http, isAddress, isHex, keccak256, pad, padHex, parseUnits, recoverAddress, size, slice, stringToHex, toBytes, toEventSelector, toFunctionSelector, toFunctionSignature, toHex, zeroAddress } from "viem";
10
+ import { concat, concatHex, createPublicClient, createWalletClient, custom, decodeAbiParameters, decodeErrorResult, decodeFunctionData, decodeFunctionResult, encodeAbiParameters, encodeFunctionData, encodePacked, formatUnits, getAddress, getContractAddress, hashMessage, hashTypedData, hexToBigInt, http, isAddress, isHex, keccak256, pad, padHex, parseUnits, recoverAddress, size, slice, stringToHex, toBytes, toEventSelector, toFunctionSelector, toFunctionSignature, toHex, zeroAddress } from "viem";
11
11
  import { z } from "zod";
12
12
  import { Cause, Context, Data, Deferred, Duration, Effect, Exit, Fiber, Layer, Queue, Ref, Result, Schedule, Schema, SchemaGetter, SchemaIssue, SchemaParser, Scope, Struct, Tracer } from "effect";
13
13
  import { privateKeyToAccount, toAccount } from "viem/accounts";
@@ -240,7 +240,7 @@ function normalizeEmail(email) {
240
240
  }
241
241
  //#endregion
242
242
  //#region package.json
243
- var version$2 = "2.5.3";
243
+ var version$2 = "2.5.5";
244
244
  //#endregion
245
245
  //#region ../../packages/errors/src/errors.ts
246
246
  const CAPXUL_ERROR_CODES = [
@@ -1491,6 +1491,24 @@ const CAPXUL_PAYMENTS_V2_ABI = [
1491
1491
  internalType: "bytes32"
1492
1492
  }]
1493
1493
  },
1494
+ {
1495
+ type: "error",
1496
+ name: "TokenCallReturnedFalse",
1497
+ inputs: [{
1498
+ name: "token",
1499
+ type: "address",
1500
+ internalType: "address"
1501
+ }]
1502
+ },
1503
+ {
1504
+ type: "error",
1505
+ name: "TokenHasNoCode",
1506
+ inputs: [{
1507
+ name: "token",
1508
+ type: "address",
1509
+ internalType: "address"
1510
+ }]
1511
+ },
1494
1512
  {
1495
1513
  type: "error",
1496
1514
  name: "ZeroAddress",
@@ -1513,7 +1531,7 @@ const CAPXUL_PAYMENTS_V2_ABI = [
1513
1531
  }
1514
1532
  ];
1515
1533
  /** Immutable CapxulPaymentsV2 deployment on Base Sepolia. */
1516
- const CAPXUL_PAYMENTS_V2_ADDRESS = "0xA3ACDD016f706eD432A9a0545C45F0943f996b60";
1534
+ const CAPXUL_PAYMENTS_V2_ADDRESS = "0x7a5c25aB7ce91d7a475B71cd1ec33E230291f8a4";
1517
1535
  //#endregion
1518
1536
  //#region ../../packages/config/src/route.ts
1519
1537
  /** USDX on Base Sepolia — the only settlement token in v1. */
@@ -2774,7 +2792,7 @@ const EVM_ADDRESS_RE = /^0x[a-fA-F0-9]{40}$/;
2774
2792
  * envelopes carrying it — so it MUST stay byte-identical across both. Exported
2775
2793
  * once here to remove the drift risk of a mirrored declaration.
2776
2794
  */
2777
- const PAYMENT_DOCUMENT_VERIFYING_CONTRACT = "0xA3ACDD016f706eD432A9a0545C45F0943f996b60";
2795
+ const PAYMENT_DOCUMENT_VERIFYING_CONTRACT = "0x7a5c25aB7ce91d7a475B71cd1ec33E230291f8a4";
2778
2796
  const PAYMENT_ID_RE = /^payment_[0-9A-Za-z]+$/;
2779
2797
  const PAYEE_ID_RE = /^payee_[0-9A-Za-z]+$/;
2780
2798
  const ORG_ID_RE = /^org_[0-9A-Za-z]+$/;
@@ -7757,73 +7775,8 @@ function isMoneyTelemetryDebugEnabled() {
7757
7775
  return globalThis.process?.env?.CAPXUL_DEBUG_TELEMETRY === "1";
7758
7776
  }
7759
7777
  //#endregion
7760
- //#region ../../packages/sdk/src/surface/payment-execution.ts
7761
- function mismatch(field, message) {
7762
- return {
7763
- ok: false,
7764
- error: Errors.invalidInput(field, message)
7765
- };
7766
- }
7767
- function cancelled(operation) {
7768
- return {
7769
- ok: false,
7770
- error: Errors.cancelled({ operation })
7771
- };
7772
- }
7773
- function isAborted$2(signal) {
7774
- return signal?.aborted === true;
7775
- }
7776
- async function signerCall(source, operation, run) {
7777
- try {
7778
- return {
7779
- ok: true,
7780
- value: await run()
7781
- };
7782
- } catch (cause) {
7783
- return {
7784
- ok: false,
7785
- error: signerFailure(source, operation, cause)
7786
- };
7787
- }
7788
- }
7789
- async function executePersonalPayment(deps, payment, signal, requestKey) {
7790
- if (isAborted$2(signal)) return cancelled("payments.pay");
7791
- if (deps.signer === void 0) return mismatch("signer", "payments.pay requires a configured CapxulSigner");
7792
- const session = deps.actor.authSession();
7793
- if (session === null) return {
7794
- ok: false,
7795
- error: Errors.notAuthenticated()
7796
- };
7797
- const signerAddress = await signerCall(deps.signer.source, "getAddress", () => deps.signer.getAddress());
7798
- if (!signerAddress.ok) return signerAddress;
7799
- const expectedSafe = deriveCapxulSafeAddress({ email: session.email });
7800
- const resolvedRequestKey = requestKey ?? `pay_${crypto.randomUUID()}`;
7801
- const prepared = await runIfActive(signal, "payments.prepareExecution", () => deps.convexCall.action(deps.functions.preparePaymentExecution, { input: {
7802
- requestKey: resolvedRequestKey,
7803
- signerAddress: signerAddress.value,
7804
- payment
7805
- } }));
7806
- if (!prepared.ok) return prepared;
7807
- if (prepared.value.requestKey !== resolvedRequestKey || JSON.stringify(prepared.value.payment) !== JSON.stringify(payment)) return mismatch("payment", "prepared Payment execution uses another request");
7808
- if (prepared.value.chainId !== deps.chainId) return mismatch("chainId", "prepared Payment execution uses another chain");
7809
- if (prepared.value.signerAddress.toLowerCase() !== signerAddress.value.toLowerCase()) return mismatch("signerAddress", "prepared Payment execution uses another signer");
7810
- if (prepared.value.userOpSenderSafe.toLowerCase() !== expectedSafe.toLowerCase()) return mismatch("userOpSenderSafe", "prepared Payment execution uses another Account Safe");
7811
- if (prepared.value.emitPaymentInitiated) await emitPaymentInitiated(deps.telemetry, {
7812
- kind: prepared.value.purposeKind,
7813
- paymentId: prepared.value.paymentId
7814
- });
7815
- if (isAborted$2(signal)) return cancelled("payments.pay");
7816
- const signature = await signerCall(deps.signer.source, "signUserOpHash", () => deps.signer.signUserOpHash(prepared.value.digest));
7817
- if (!signature.ok) return signature;
7818
- if (isAborted$2(signal)) return cancelled("payments.pay");
7819
- return runIfActive(void 0, "payments.submitExecution", () => deps.convexCall.action(deps.functions.submitPaymentExecution, { input: {
7820
- executionId: prepared.value.executionId,
7821
- signature: signature.value
7822
- } }));
7823
- }
7824
- //#endregion
7825
7778
  //#region ../../packages/sdk/src/surface/payment-command-execution.ts
7826
- function isAborted$1(signal) {
7779
+ function isAborted$2(signal) {
7827
7780
  return signal?.aborted === true;
7828
7781
  }
7829
7782
  function canonicalJson(value) {
@@ -7839,7 +7792,7 @@ function matchesIntent(expected) {
7839
7792
  return async (request) => await fingerprintPaymentIntent(request) === await fingerprintPaymentIntent(expected);
7840
7793
  }
7841
7794
  async function executePrepared(deps, prepare, isExpectedRequest, signal) {
7842
- if (isAborted$1(signal)) return {
7795
+ if (isAborted$2(signal)) return {
7843
7796
  ok: false,
7844
7797
  error: Errors.cancelled({ operation: "payments" })
7845
7798
  };
@@ -7868,7 +7821,7 @@ async function executePrepared(deps, prepare, isExpectedRequest, signal) {
7868
7821
  ok: false,
7869
7822
  error: Errors.invalidInput("payment", "prepared authority mismatch")
7870
7823
  };
7871
- if (isAborted$1(signal)) return {
7824
+ if (isAborted$2(signal)) return {
7872
7825
  ok: false,
7873
7826
  error: Errors.cancelled({ operation: "payments" })
7874
7827
  };
@@ -7881,7 +7834,7 @@ async function executePrepared(deps, prepare, isExpectedRequest, signal) {
7881
7834
  error: signerFailure(deps.signer.source, "signUserOpHash", cause)
7882
7835
  };
7883
7836
  }
7884
- if (isAborted$1(signal)) return {
7837
+ if (isAborted$2(signal)) return {
7885
7838
  ok: false,
7886
7839
  error: Errors.cancelled({ operation: "payments" })
7887
7840
  };
@@ -7903,6 +7856,71 @@ function executeOrganizationPayment(deps, input, signal) {
7903
7856
  } })), matchesIntent(input), signal);
7904
7857
  }
7905
7858
  //#endregion
7859
+ //#region ../../packages/sdk/src/surface/payment-execution.ts
7860
+ function mismatch(field, message) {
7861
+ return {
7862
+ ok: false,
7863
+ error: Errors.invalidInput(field, message)
7864
+ };
7865
+ }
7866
+ function cancelled(operation) {
7867
+ return {
7868
+ ok: false,
7869
+ error: Errors.cancelled({ operation })
7870
+ };
7871
+ }
7872
+ function isAborted$1(signal) {
7873
+ return signal?.aborted === true;
7874
+ }
7875
+ async function signerCall(source, operation, run) {
7876
+ try {
7877
+ return {
7878
+ ok: true,
7879
+ value: await run()
7880
+ };
7881
+ } catch (cause) {
7882
+ return {
7883
+ ok: false,
7884
+ error: signerFailure(source, operation, cause)
7885
+ };
7886
+ }
7887
+ }
7888
+ async function executePersonalPayment(deps, payment, signal, requestKey) {
7889
+ if (isAborted$1(signal)) return cancelled("payments.pay");
7890
+ if (deps.signer === void 0) return mismatch("signer", "payments.pay requires a configured CapxulSigner");
7891
+ const session = deps.actor.authSession();
7892
+ if (session === null) return {
7893
+ ok: false,
7894
+ error: Errors.notAuthenticated()
7895
+ };
7896
+ const signerAddress = await signerCall(deps.signer.source, "getAddress", () => deps.signer.getAddress());
7897
+ if (!signerAddress.ok) return signerAddress;
7898
+ const expectedSafe = deriveCapxulSafeAddress({ email: session.email });
7899
+ const resolvedRequestKey = requestKey ?? `pay_${crypto.randomUUID()}`;
7900
+ const prepared = await runIfActive(signal, "payments.prepareExecution", () => deps.convexCall.action(deps.functions.preparePaymentExecution, { input: {
7901
+ requestKey: resolvedRequestKey,
7902
+ signerAddress: signerAddress.value,
7903
+ payment
7904
+ } }));
7905
+ if (!prepared.ok) return prepared;
7906
+ if (prepared.value.requestKey !== resolvedRequestKey || canonicalJson(prepared.value.payment) !== canonicalJson(payment)) return mismatch("payment", "prepared Payment execution uses another request");
7907
+ if (prepared.value.chainId !== deps.chainId) return mismatch("chainId", "prepared Payment execution uses another chain");
7908
+ if (prepared.value.signerAddress.toLowerCase() !== signerAddress.value.toLowerCase()) return mismatch("signerAddress", "prepared Payment execution uses another signer");
7909
+ if (prepared.value.userOpSenderSafe.toLowerCase() !== expectedSafe.toLowerCase()) return mismatch("userOpSenderSafe", "prepared Payment execution uses another Account Safe");
7910
+ if (prepared.value.emitPaymentInitiated) await emitPaymentInitiated(deps.telemetry, {
7911
+ kind: prepared.value.purposeKind,
7912
+ paymentId: prepared.value.paymentId
7913
+ });
7914
+ if (isAborted$1(signal)) return cancelled("payments.pay");
7915
+ const signature = await signerCall(deps.signer.source, "signUserOpHash", () => deps.signer.signUserOpHash(prepared.value.digest));
7916
+ if (!signature.ok) return signature;
7917
+ if (isAborted$1(signal)) return cancelled("payments.pay");
7918
+ return runIfActive(void 0, "payments.submitExecution", () => deps.convexCall.action(deps.functions.submitPaymentExecution, { input: {
7919
+ executionId: prepared.value.executionId,
7920
+ signature: signature.value
7921
+ } }));
7922
+ }
7923
+ //#endregion
7906
7924
  //#region ../../packages/sdk/src/surface/money.ts
7907
7925
  function actorReferenceToBackend(actor) {
7908
7926
  if (actor === void 0) return void 0;
@@ -8912,7 +8930,7 @@ async function recoverRawDigestSigner(input) {
8912
8930
  }
8913
8931
  //#endregion
8914
8932
  //#region ../../packages/sdk/package.json
8915
- var version = "2.5.3";
8933
+ var version = "2.5.5";
8916
8934
  //#endregion
8917
8935
  //#region ../../packages/observability/src/engineering.ts
8918
8936
  const ENGINEERING_CAPXUL_ENVS = [
@@ -13622,7 +13640,8 @@ var ConvexOrganizationSetupAdapter = class {
13622
13640
  confirmSubmittedBootstrap(input) {
13623
13641
  return this.#lifecycleAction("confirmBootstrap", input, () => this.#convex.action(this.#fns.confirmBootstrap, copyInvocationObservation(input, {
13624
13642
  orgId: input.orgId,
13625
- ...input.observationContext === void 0 ? {} : { observationContext: input.observationContext }
13643
+ ...input.observationContext === void 0 ? {} : { observationContext: input.observationContext },
13644
+ ...input.retryDelayMs === void 0 ? {} : { retryDelayMs: input.retryDelayMs }
13626
13645
  })));
13627
13646
  }
13628
13647
  async recordFailure(input) {
@@ -13941,6 +13960,28 @@ const FaucetFailedProps = Schema.Struct({
13941
13960
  ...TelemetryEnvelopeProps,
13942
13961
  reason: OptionalString
13943
13962
  });
13963
+ const AaGatewayUpstreamFallbackProps = Schema.Struct({
13964
+ ...TelemetryEnvelopeProps,
13965
+ method: Schema.String,
13966
+ from_upstream: Schema.Literals([
13967
+ "alchemy",
13968
+ "infura",
13969
+ "public"
13970
+ ]),
13971
+ to_upstream: Schema.optional(Schema.Literals([
13972
+ "alchemy",
13973
+ "infura",
13974
+ "public"
13975
+ ])),
13976
+ failure: Schema.Literals([
13977
+ "http-429",
13978
+ "http-5xx",
13979
+ "rpc-rate-limit",
13980
+ "timeout",
13981
+ "network"
13982
+ ]),
13983
+ status: Schema.optional(Schema.Number)
13984
+ });
13944
13985
  const ORG_ID_TELEMETRY_RE = /^org_[0-9A-Za-z]+$/;
13945
13986
  const OrgIdTelemetrySchema = Schema.String.pipe(Schema.refine((value) => ORG_ID_TELEMETRY_RE.test(value), { message: "must be org_ plus an alphanumeric id" }));
13946
13987
  const OptionalOrgId = Schema.optional(OrgIdTelemetrySchema);
@@ -13991,6 +14032,8 @@ const OrganizationCreationFailedProps = Schema.Struct({
13991
14032
  stage: OnboardingStageSchema,
13992
14033
  error_code: Schema.String,
13993
14034
  retryable: Schema.Boolean,
14035
+ /** #1655: the SDK's backoff before this attempt. Absent on the first attempt. */
14036
+ backoff_ms: Schema.optional(DurationMsSchema),
13994
14037
  failure_reason: Schema.optional(Schema.Literals([
13995
14038
  "deterministic_address_mismatch",
13996
14039
  "receipt_provider_unavailable",
@@ -14241,6 +14284,10 @@ Schema.Struct({
14241
14284
  name: Schema.Literal("faucet_failed"),
14242
14285
  props: FaucetFailedProps
14243
14286
  });
14287
+ Schema.Struct({
14288
+ name: Schema.Literal("aa_gateway_upstream_fallback"),
14289
+ props: AaGatewayUpstreamFallbackProps
14290
+ });
14244
14291
  Schema.Struct({
14245
14292
  name: Schema.Literal("org_create_started"),
14246
14293
  props: OrgCreateStartedProps
@@ -37456,6 +37503,7 @@ function createOpenfortBrowserSignerFromBootstrap(bootstrap, options = {}) {
37456
37503
  return {
37457
37504
  ...signer,
37458
37505
  statusStore,
37506
+ ensureWalletReady: ensureOpenfortWalletReady,
37459
37507
  getAddress: async () => {
37460
37508
  try {
37461
37509
  const address = await signer.getAddress();
@@ -37524,6 +37572,29 @@ const IDENTITY_SLOT_BY_EVENT = {
37524
37572
  OrgFailed: IDENTITY_SLOT.org
37525
37573
  };
37526
37574
  const identitySlot = (event) => IDENTITY_SLOT_BY_EVENT[event._tag];
37575
+ /** 2 s, 4 s, 8 s, 16 s, 32 s, 60 s, 60 s: about three minutes, then the user decides. */
37576
+ const DEFAULT_CONFIRMATION_BACKOFF = {
37577
+ initialDelayMs: 2e3,
37578
+ maxDelayMs: 6e4,
37579
+ maxRetries: 7
37580
+ };
37581
+ /**
37582
+ * A public partial override must not bring the tight loop back: a zero,
37583
+ * negative, or non-finite delay, or a non-integer or infinite retry count,
37584
+ * falls back to the default for that field. `maxDelayMs` is never below
37585
+ * `initialDelayMs`.
37586
+ */
37587
+ const positiveMs = (value, fallback) => value !== void 0 && Number.isFinite(value) && value > 0 ? value : fallback;
37588
+ function normalizeConfirmationBackoff(override) {
37589
+ const initialDelayMs = positiveMs(override?.initialDelayMs, DEFAULT_CONFIRMATION_BACKOFF.initialDelayMs);
37590
+ const maxDelayMs = Math.max(initialDelayMs, positiveMs(override?.maxDelayMs, DEFAULT_CONFIRMATION_BACKOFF.maxDelayMs));
37591
+ const retries = override?.maxRetries;
37592
+ return {
37593
+ initialDelayMs,
37594
+ maxDelayMs,
37595
+ maxRetries: retries !== void 0 && Number.isSafeInteger(retries) && retries >= 0 ? retries : DEFAULT_CONFIRMATION_BACKOFF.maxRetries
37596
+ };
37597
+ }
37527
37598
  const failureOf = (error) => {
37528
37599
  if (error instanceof CapxulError) {
37529
37600
  const mode = error.details?.failure_mode;
@@ -37632,7 +37703,7 @@ const orgEngineeringContext = (controls, parent) => {
37632
37703
  ...traceparent === void 0 ? {} : { traceparent }
37633
37704
  };
37634
37705
  };
37635
- const runOrgStep = (setup, orgId, step, controls) => {
37706
+ const runOrgStep = (setup, orgId, step, controls, retryDelayMs) => {
37636
37707
  const [name, invoke] = step === "preparingFounderAccount" ? ["organization-setup.prepare-founder-account", (parent) => setup.prepareFounderAccount({
37637
37708
  orgId,
37638
37709
  observationContext: orgEngineeringContext(controls, parent)
@@ -37644,11 +37715,12 @@ const runOrgStep = (setup, orgId, step, controls) => {
37644
37715
  observationContext: orgEngineeringContext(controls, parent)
37645
37716
  })] : ["organization-setup.confirm-submitted-bootstrap", (parent) => setup.confirmSubmittedBootstrap({
37646
37717
  orgId,
37647
- observationContext: orgEngineeringContext(controls, parent)
37718
+ observationContext: orgEngineeringContext(controls, parent),
37719
+ ...retryDelayMs === void 0 ? {} : { retryDelayMs }
37648
37720
  })];
37649
37721
  return resultEffect(name, invoke);
37650
37722
  };
37651
- const orgLane = (setup, start, send, controls) => Effect.gen(function* () {
37723
+ const orgLane = (setup, start, send, controls, backoff) => Effect.gen(function* () {
37652
37724
  let orgId;
37653
37725
  let lifecycle;
37654
37726
  if (start.kind === "create") {
@@ -37711,9 +37783,12 @@ const orgLane = (setup, start, send, controls) => Effect.gen(function* () {
37711
37783
  orgId,
37712
37784
  step
37713
37785
  });
37786
+ let retries = 0;
37787
+ let retryDelayMs;
37714
37788
  while (step !== "ready") {
37715
37789
  const current = step;
37716
- const advanced = yield* Effect.result(runOrgStep(setup, orgId, current, controls));
37790
+ const advanced = yield* Effect.result(runOrgStep(setup, orgId, current, controls, retryDelayMs));
37791
+ retryDelayMs = void 0;
37717
37792
  if (Result.isFailure(advanced)) {
37718
37793
  yield* send({
37719
37794
  _tag: "OrgFailed",
@@ -37725,6 +37800,38 @@ const orgLane = (setup, start, send, controls) => Effect.gen(function* () {
37725
37800
  }
37726
37801
  lifecycle = advanced.success;
37727
37802
  if (lifecycle.status === "failed") {
37803
+ if (lifecycle.at === "confirmingBootstrap" && lifecycle.retryable && retries < backoff.maxRetries) {
37804
+ const delayMs = Math.min(backoff.initialDelayMs * 2 ** retries, backoff.maxDelayMs);
37805
+ retries += 1;
37806
+ yield* Effect.sleep(Duration.millis(delayMs));
37807
+ const reset = yield* Effect.result(resultEffect("organization-setup.retry", (parent) => setup.retry({
37808
+ orgId,
37809
+ observationContext: orgEngineeringContext(controls, parent)
37810
+ })));
37811
+ if (Result.isFailure(reset)) {
37812
+ yield* send({
37813
+ _tag: "OrgFailed",
37814
+ orgId,
37815
+ step: current,
37816
+ failure: reset.failure
37817
+ });
37818
+ return yield* Effect.fail(reset.failure);
37819
+ }
37820
+ lifecycle = reset.success;
37821
+ if (lifecycle.status !== "failed") {
37822
+ retryDelayMs = delayMs;
37823
+ step = orgStep(lifecycle);
37824
+ yield* step === "ready" ? send({
37825
+ _tag: "OrgReady",
37826
+ orgId
37827
+ }) : send({
37828
+ _tag: "OrgAt",
37829
+ orgId,
37830
+ step
37831
+ });
37832
+ continue;
37833
+ }
37834
+ }
37728
37835
  const failure = failureOf(lifecycle.error);
37729
37836
  yield* send({
37730
37837
  _tag: "OrgFailed",
@@ -37803,6 +37910,7 @@ const identitySpec = (input, sessionStore = { current: null }) => {
37803
37910
  hasSigner: input.signer !== void 0,
37804
37911
  ...input.otpTtlMs === void 0 ? {} : { otpTtlMs: input.otpTtlMs }
37805
37912
  };
37913
+ const backoff = normalizeConfirmationBackoff(input.confirmationBackoff);
37806
37914
  return {
37807
37915
  machine: "identity",
37808
37916
  initial: RESTORING,
@@ -37908,7 +38016,7 @@ const identitySpec = (input, sessionStore = { current: null }) => {
37908
38016
  run: (send, controls) => orgLane(input.organizationSetup, {
37909
38017
  kind: "create",
37910
38018
  draft: event.draft
37911
- }, send, controls)
38019
+ }, send, controls, backoff)
37912
38020
  };
37913
38021
  case "AttachOrganization": return input.organizationSetup === void 0 || org?.at !== "loading" ? void 0 : {
37914
38022
  slot: IDENTITY_SLOT.org,
@@ -37916,7 +38024,7 @@ const identitySpec = (input, sessionStore = { current: null }) => {
37916
38024
  run: (send, controls) => orgLane(input.organizationSetup, {
37917
38025
  kind: "attach",
37918
38026
  orgId: org.orgId
37919
- }, send, controls)
38027
+ }, send, controls, backoff)
37920
38028
  };
37921
38029
  case "RetryOrganization": return input.organizationSetup === void 0 || org?.at !== "settingUp" ? void 0 : {
37922
38030
  slot: IDENTITY_SLOT.org,
@@ -37924,7 +38032,7 @@ const identitySpec = (input, sessionStore = { current: null }) => {
37924
38032
  run: (send, controls) => orgLane(input.organizationSetup, {
37925
38033
  kind: "retry",
37926
38034
  orgId: org.orgId
37927
- }, send, controls)
38035
+ }, send, controls, backoff)
37928
38036
  };
37929
38037
  default: return;
37930
38038
  }
@@ -40094,6 +40202,43 @@ function executeIdentityProductObservation(telemetry, record, state) {
40094
40202
  }
40095
40203
  //#endregion
40096
40204
  //#region ../../packages/sdk/src/surface/create-capxul-client.ts
40205
+ /**
40206
+ * Start the signer readiness cycle when the identity becomes claimed (#1667).
40207
+ *
40208
+ * The cycle used to run only from the embedded-wallet port's `getAddress` and
40209
+ * `signRawDigest`. Nothing calls those after a sign-in or a session restore,
40210
+ * and `resetSession`, which every OTP verify performs, sets the status back to
40211
+ * `unknown`. Thus `client.signer.status()` never left `unknown` on a fresh
40212
+ * session, and each `.Actions` gate that requires `ready` stayed closed. A
40213
+ * claimed identity is the first point where the browser signer has a session to
40214
+ * recover. A signed-out client starts no cycle and reports `unknown`.
40215
+ *
40216
+ * The assembly does not await the call, on purpose: readiness must converge
40217
+ * without a signature. The cycle reports its own failure. It writes
40218
+ * `unavailable` to the same store the gate reads, and adds a DiagnosticPort
40219
+ * breadcrumb, and the next `getAddress` retries it, as before. The rejection is
40220
+ * thus observed and not discarded. A throw here would only cause an unhandled
40221
+ * rejection, and the actor shell removes an observer that throws.
40222
+ *
40223
+ * The `unknown` test holds this to ONE cycle per session. The call sets the
40224
+ * status to `recovering` synchronously, so the later claimed transitions of the
40225
+ * same session, such as the org lane, start no second cycle, and a
40226
+ * `resetSession` that sets the status back to `unknown` permits one more.
40227
+ *
40228
+ * ponytail: one cycle per claim. A cycle that fails stays `unavailable` until
40229
+ * a `getAddress` or a new claim, so a gate that refuses to sign while
40230
+ * `unavailable` needs a reload. Give the action part an explicit retry if that
40231
+ * becomes the common failure.
40232
+ */
40233
+ function startSignerReadinessOnClaim(actor, signer) {
40234
+ if (signer?.statusStore === void 0 || signer.ensureWalletReady === void 0) return () => {};
40235
+ const browserSigner = signer;
40236
+ return actor.subscribe((state) => {
40237
+ if (state.phase !== "authenticated" || state.account.at !== "claimed") return;
40238
+ if (browserSigner.statusStore?.status() !== "unknown") return;
40239
+ browserSigner.ensureWalletReady?.().catch(() => {});
40240
+ });
40241
+ }
40097
40242
  /** Join the assembled actor lifetime to the adapter lifetime for internal client factories. */
40098
40243
  function withAdapterClose(client, closeAdapter) {
40099
40244
  const closeActor = client._internal.close;
@@ -40137,11 +40282,13 @@ function assembleCapxulClient(input) {
40137
40282
  error: transitionError(record)
40138
40283
  }, failureObservation, `identity.${record.event}`, "machine");
40139
40284
  });
40285
+ const unsubscribeSignerReadiness = startSignerReadinessOnClaim(actor, input.signer);
40140
40286
  let stopPromise = null;
40141
40287
  const stopActor = () => {
40142
40288
  if (stopPromise === null) {
40143
40289
  unsubscribeProductTelemetry();
40144
40290
  unsubscribeFailureObservation();
40291
+ unsubscribeSignerReadiness();
40145
40292
  stopPromise = effectRunner.runPromise(Scope.close(scope, Exit.void));
40146
40293
  }
40147
40294
  return stopPromise;
@@ -42793,6 +42940,18 @@ const envFields = {
42793
42940
  "required": false,
42794
42941
  "example": "https://aa-gateway.example.test/token"
42795
42942
  },
42943
+ BASE_SEPOLIA_ALCHEMY_RPC_URL: {
42944
+ "runtime": "server",
42945
+ "kind": "url",
42946
+ "required": false,
42947
+ "example": "https://base-sepolia.g.alchemy.com/v2/key"
42948
+ },
42949
+ BASE_SEPOLIA_INFURA_RPC_URL: {
42950
+ "runtime": "server",
42951
+ "kind": "url",
42952
+ "required": false,
42953
+ "example": "https://base-sepolia.infura.io/v3/key"
42954
+ },
42796
42955
  CONVEX_SITE_URL: {
42797
42956
  "runtime": "server",
42798
42957
  "kind": "url",
@@ -43191,6 +43350,159 @@ function optionalEnv(name) {
43191
43350
  return value && value.length > 0 ? value : void 0;
43192
43351
  }
43193
43352
  //#endregion
43353
+ //#region ../../packages/backend/convex/_shared/userOperationRevert.ts
43354
+ /** OpenZeppelin v5 ERC-20 errors (ERC-6093). The token contracts on Base Sepolia use them. */
43355
+ const ERC20_ERRORS_ABI = [
43356
+ {
43357
+ type: "error",
43358
+ name: "ERC20InsufficientBalance",
43359
+ inputs: [
43360
+ {
43361
+ name: "sender",
43362
+ type: "address"
43363
+ },
43364
+ {
43365
+ name: "balance",
43366
+ type: "uint256"
43367
+ },
43368
+ {
43369
+ name: "needed",
43370
+ type: "uint256"
43371
+ }
43372
+ ]
43373
+ },
43374
+ {
43375
+ type: "error",
43376
+ name: "ERC20InsufficientAllowance",
43377
+ inputs: [
43378
+ {
43379
+ name: "spender",
43380
+ type: "address"
43381
+ },
43382
+ {
43383
+ name: "allowance",
43384
+ type: "uint256"
43385
+ },
43386
+ {
43387
+ name: "needed",
43388
+ type: "uint256"
43389
+ }
43390
+ ]
43391
+ },
43392
+ {
43393
+ type: "error",
43394
+ name: "ERC20InvalidSender",
43395
+ inputs: [{
43396
+ name: "sender",
43397
+ type: "address"
43398
+ }]
43399
+ },
43400
+ {
43401
+ type: "error",
43402
+ name: "ERC20InvalidReceiver",
43403
+ inputs: [{
43404
+ name: "receiver",
43405
+ type: "address"
43406
+ }]
43407
+ },
43408
+ {
43409
+ type: "error",
43410
+ name: "ERC20InvalidApprover",
43411
+ inputs: [{
43412
+ name: "approver",
43413
+ type: "address"
43414
+ }]
43415
+ },
43416
+ {
43417
+ type: "error",
43418
+ name: "ERC20InvalidSpender",
43419
+ inputs: [{
43420
+ name: "spender",
43421
+ type: "address"
43422
+ }]
43423
+ }
43424
+ ];
43425
+ const REVERT_ABI = [...CAPXUL_PAYMENTS_V2_ABI, ...ERC20_ERRORS_ABI];
43426
+ const REASON_RE = /reason:\s*(0x[0-9a-fA-F]*)/u;
43427
+ const SELECTOR_LENGTH = 10;
43428
+ function stringifyArg(value) {
43429
+ if (typeof value === "bigint") return value.toString(10);
43430
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return String(value);
43431
+ return JSON.stringify(value);
43432
+ }
43433
+ /** Decode revert data. Never throws: an unknown selector yields `name: null`. */
43434
+ function decodeRevertData(data) {
43435
+ const selector = data.length >= SELECTOR_LENGTH ? data.slice(0, SELECTOR_LENGTH) : "0x";
43436
+ if (selector === "0x") return {
43437
+ data,
43438
+ selector,
43439
+ name: null,
43440
+ args: {}
43441
+ };
43442
+ try {
43443
+ const decoded = decodeErrorResult({
43444
+ abi: REVERT_ABI,
43445
+ data
43446
+ });
43447
+ const inputs = decoded.abiItem.type === "error" ? decoded.abiItem.inputs.map((input) => input.name) : [];
43448
+ const args = {};
43449
+ (decoded.args ?? []).forEach((value, index) => {
43450
+ args[inputs[index] ?? String(index)] = stringifyArg(value);
43451
+ });
43452
+ return {
43453
+ data,
43454
+ selector,
43455
+ name: decoded.errorName,
43456
+ args
43457
+ };
43458
+ } catch {
43459
+ return {
43460
+ data,
43461
+ selector,
43462
+ name: null,
43463
+ args: {}
43464
+ };
43465
+ }
43466
+ }
43467
+ /** The revert data a bundler message carries, or null when the message names none. */
43468
+ function revertDataInMessage(message) {
43469
+ const match = REASON_RE.exec(message);
43470
+ return match?.[1] === void 0 ? null : match[1];
43471
+ }
43472
+ /** `ERC20InsufficientBalance(sender=0x…, balance=1000000000, needed=50000000000000)`. */
43473
+ function describeRevert(revert) {
43474
+ if (revert.name === null) return revert.selector === "0x" ? "empty revert" : `unknown selector ${revert.selector}`;
43475
+ const args = Object.entries(revert.args).map(([name, value]) => `${name}=${value}`).join(", ");
43476
+ return `${revert.name}(${args})`;
43477
+ }
43478
+ /** Decode the revert in a bundler error message, or null when there is none. */
43479
+ function decodeUserOperationRevert(message) {
43480
+ const data = revertDataInMessage(message);
43481
+ return data === null ? null : decodeRevertData(data);
43482
+ }
43483
+ /**
43484
+ * A sponsorship failure whose decoded revert is the token's insufficient
43485
+ * balance is a product outcome, not a provider defect: return it as
43486
+ * `INSUFFICIENT_BALANCE` with the token's own numbers. Every other failure
43487
+ * passes through unchanged (an allowance failure is a route bug and stays a
43488
+ * provider error for error tracking).
43489
+ */
43490
+ function typedSponsorshipFailure(error) {
43491
+ if (!(error instanceof CapxulError) || error.details?.revert_name !== "ERC20InsufficientBalance") return error;
43492
+ const args = error.details.revert_args;
43493
+ return new CapxulError("INSUFFICIENT_BALANCE", "Insufficient token balance", {
43494
+ cause: error,
43495
+ details: {
43496
+ asset: "token",
43497
+ available: args?.balance ?? "unknown",
43498
+ required: args?.needed ?? "unknown",
43499
+ sender: args?.sender ?? "unknown",
43500
+ revert: error.details.revert
43501
+ },
43502
+ ...error.correlationId === void 0 ? {} : { correlationId: error.correlationId }
43503
+ });
43504
+ }
43505
+ //#endregion
43194
43506
  //#region ../../packages/backend/convex/_shared/alchemyRpc.ts
43195
43507
  const TX_HASH_HEX = /^0x[0-9a-fA-F]{64}$/;
43196
43508
  const ADDRESS_HEX = /^0x[0-9a-fA-F]{40}$/;
@@ -43214,7 +43526,7 @@ const BUNDLER_RPC_METHODS = new Set([
43214
43526
  ]);
43215
43527
  function rpcProviderRole(chainId, method) {
43216
43528
  if (BUNDLER_RPC_METHODS.has(method)) return "account-abstraction";
43217
- if (chainId === 84532 && EVIDENCE_RPC_METHODS.has(method) && optionalEnv("BASE_SEPOLIA_EVIDENCE_RPC_URL") !== void 0) return "chain-evidence";
43529
+ if (EVIDENCE_RPC_METHODS.has(method) && hostedUpstreams(chainId).length > 0) return "chain-evidence";
43218
43530
  return "chain-rpc";
43219
43531
  }
43220
43532
  function accountAbstractionUrl(chainId) {
@@ -43225,9 +43537,25 @@ function rpcProviderError(operation, cause, chainId) {
43225
43537
  const method = operation.split(" ", 1)[0] ?? operation;
43226
43538
  return Errors.providerError(rpcProviderRole(chainId, method), operation, cause);
43227
43539
  }
43228
- function rethrowProvider(chainId, method) {
43540
+ /**
43541
+ * A failure the next upstream may not share: transport, timeout, 5xx, or a
43542
+ * rate limit. `rateLimited` sets the `rate-limited` failure mode the SDK
43543
+ * treats as retryable (#1684, #1655).
43544
+ */
43545
+ function transientProviderError(operation, cause, chainId, rateLimited) {
43546
+ const method = operation.split(" ", 1)[0] ?? operation;
43547
+ return Errors.providerError(rpcProviderRole(chainId, method), operation, cause, {
43548
+ ...rateLimited ? { failure_mode: "rate-limited" } : {},
43549
+ details: { transient: true }
43550
+ });
43551
+ }
43552
+ function isTransientProviderError(error) {
43553
+ return error instanceof CapxulError && error.details?.transient === true;
43554
+ }
43555
+ function rethrowTransient(chainId, method, externalSignal) {
43229
43556
  return (e) => {
43230
- throw rpcProviderError(method, e, chainId);
43557
+ if (externalSignal?.aborted === true) throw rpcProviderError(method, e, chainId);
43558
+ throw transientProviderError(method, e, chainId, false);
43231
43559
  };
43232
43560
  }
43233
43561
  function parseRpcQuantity(value, operation, field, chainId) {
@@ -43268,6 +43596,62 @@ function nodeRpcUrl(chainId) {
43268
43596
  default: throw Errors.invalidInput("chainId", `unsupported chainId ${String(chainId)}`);
43269
43597
  }
43270
43598
  }
43599
+ /**
43600
+ * Evidence sizes for a decoded simulation revert (#1685). The bundler message
43601
+ * is provider-controlled: keep the decoded name and selector whole, and cap
43602
+ * every free-form string so one oversized answer cannot inflate an exception
43603
+ * payload. The reporter masks credential-shaped values on top of this.
43604
+ */
43605
+ const REVERT_LINE_MAX = 400;
43606
+ const REVERT_ARG_MAX = 128;
43607
+ const REVERT_DATA_MAX = 522;
43608
+ const BUNDLER_MESSAGE_MAX = 300;
43609
+ function clip(value, max) {
43610
+ return value.length <= max ? value : `${value.slice(0, max)}…(${String(value.length)} chars)`;
43611
+ }
43612
+ function boundedRevertDetails(revert, bundlerMessage) {
43613
+ const args = {};
43614
+ for (const [name, value] of Object.entries(revert.args).slice(0, 8)) args[clip(name, 32)] = clip(value, REVERT_ARG_MAX);
43615
+ return {
43616
+ revert: clip(describeRevert(revert), REVERT_LINE_MAX),
43617
+ revert_name: revert.name,
43618
+ revert_selector: revert.selector,
43619
+ revert_args: args,
43620
+ revert_data: clip(revert.data, REVERT_DATA_MAX),
43621
+ bundler_message: clip(bundlerMessage, BUNDLER_MESSAGE_MAX)
43622
+ };
43623
+ }
43624
+ /**
43625
+ * JSON-RPC "limit exceeded". Providers use it for rate limits and the AA
43626
+ * Gateway returns it when alto failed while its upstream chain was exhausted
43627
+ * (`packages/aa-gateway/src/modules/upstream/types.ts`).
43628
+ */
43629
+ const RATE_LIMITED_RPC_CODE = -32005;
43630
+ const RATE_LIMIT_MESSAGE = /rate limit|too many requests|throttl|capacity/iu;
43631
+ /** Alchemy's free tier caps `eth_getLogs` at 10 blocks; evidence reads span thousands. */
43632
+ const WIDE_LOG_READS = new Set(["eth_getLogs"]);
43633
+ function stripSlash(url) {
43634
+ return url.replace(/\/+$/u, "");
43635
+ }
43636
+ function hostedUpstreams(chainId) {
43637
+ if (chainId !== 84532) return [];
43638
+ const alchemy = optionalEnv("BASE_SEPOLIA_ALCHEMY_RPC_URL");
43639
+ const infura = optionalEnv("BASE_SEPOLIA_INFURA_RPC_URL") ?? optionalEnv("BASE_SEPOLIA_EVIDENCE_RPC_URL");
43640
+ return [...alchemy === void 0 ? [] : [{
43641
+ name: "alchemy",
43642
+ url: stripSlash(alchemy)
43643
+ }], ...infura === void 0 ? [] : [{
43644
+ name: "infura",
43645
+ url: stripSlash(infura)
43646
+ }]];
43647
+ }
43648
+ /** Node upstreams in the order one method tries them. Always ends on the public node. */
43649
+ function nodeRpcCandidates(chainId, method) {
43650
+ return [...hostedUpstreams(chainId).filter((upstream) => !(WIDE_LOG_READS.has(method) && upstream.name === "alchemy")), {
43651
+ name: "public",
43652
+ url: nodeRpcUrl(chainId)
43653
+ }];
43654
+ }
43271
43655
  function isRecord(value) {
43272
43656
  return typeof value === "object" && value !== null && !Array.isArray(value);
43273
43657
  }
@@ -43285,9 +43669,27 @@ var DefinitiveBundlerJsonRpcRejection = class extends Error {
43285
43669
  }
43286
43670
  };
43287
43671
  async function alchemyRpc(chainId, method, params, timeoutMs, externalSignal) {
43288
- const bundlerUrl = BUNDLER_RPC_METHODS.has(method) ? accountAbstractionUrl(chainId) : void 0;
43289
- const evidenceUrl = chainId === 84532 && EVIDENCE_RPC_METHODS.has(method) ? optionalEnv("BASE_SEPOLIA_EVIDENCE_RPC_URL") : void 0;
43290
- const url = bundlerUrl?.replace(/\/+$/u, "") ?? evidenceUrl?.replace(/\/+$/u, "") ?? nodeRpcUrl(chainId);
43672
+ if (BUNDLER_RPC_METHODS.has(method)) return jsonRpcOnce(chainId, method, params, stripSlash(accountAbstractionUrl(chainId)), timeoutMs, externalSignal);
43673
+ const candidates = nodeRpcCandidates(chainId, method);
43674
+ let lastError;
43675
+ for (const [index, upstream] of candidates.entries()) try {
43676
+ return await jsonRpcOnce(chainId, method, params, upstream.url, timeoutMs, externalSignal);
43677
+ } catch (error) {
43678
+ const next = candidates[index + 1];
43679
+ if (next === void 0 || !isTransientProviderError(error)) throw error;
43680
+ lastError = error;
43681
+ console.warn(JSON.stringify({
43682
+ event: "rpc_upstream_fallback",
43683
+ method,
43684
+ from: upstream.name,
43685
+ to: next.name,
43686
+ operation: error.details?.operation,
43687
+ rate_limited: error.details?.failure_mode === "rate-limited"
43688
+ }));
43689
+ }
43690
+ throw lastError ?? rpcProviderError(method, "no upstream configured", chainId);
43691
+ }
43692
+ async function jsonRpcOnce(chainId, method, params, url, timeoutMs, externalSignal) {
43291
43693
  const timeoutSignal = timeoutMs === void 0 ? void 0 : AbortSignal.timeout(timeoutMs);
43292
43694
  const signal = externalSignal === void 0 ? timeoutSignal : timeoutSignal === void 0 ? externalSignal : AbortSignal.any([externalSignal, timeoutSignal]);
43293
43695
  const res = await fetch(url, {
@@ -43300,10 +43702,12 @@ async function alchemyRpc(chainId, method, params, timeoutMs, externalSignal) {
43300
43702
  params
43301
43703
  }),
43302
43704
  ...signal === void 0 ? {} : { signal }
43303
- }).catch(rethrowProvider(chainId, method));
43705
+ }).catch(rethrowTransient(chainId, method, externalSignal));
43304
43706
  if (!res.ok) {
43305
43707
  const body = await res.text().catch(() => "<no body>");
43306
- throw rpcProviderError(`${method} ${res.status}`, body, chainId);
43708
+ const operation = `${method} ${res.status}`;
43709
+ if (res.status === 429 || res.status >= 500) throw transientProviderError(operation, body, chainId, res.status === 429);
43710
+ throw rpcProviderError(operation, body, chainId);
43307
43711
  }
43308
43712
  let json;
43309
43713
  try {
@@ -43314,7 +43718,11 @@ async function alchemyRpc(chainId, method, params, timeoutMs, externalSignal) {
43314
43718
  if (!isValidJsonRpcEnvelope(json)) throw rpcProviderError(method, "malformed JSON-RPC envelope", chainId);
43315
43719
  if (json.error !== void 0) {
43316
43720
  if (!isValidJsonRpcError(json.error)) throw rpcProviderError(method, "malformed JSON-RPC error", chainId);
43317
- throw rpcProviderError(method, method === "eth_sendUserOperation" ? new DefinitiveBundlerJsonRpcRejection() : json.error.message, chainId);
43721
+ if (json.error.code === RATE_LIMITED_RPC_CODE || RATE_LIMIT_MESSAGE.test(json.error.message)) throw transientProviderError(method, json.error.message, chainId, true);
43722
+ const cause = method === "eth_sendUserOperation" ? new DefinitiveBundlerJsonRpcRejection() : json.error.message;
43723
+ const revert = BUNDLER_RPC_METHODS.has(method) ? decodeUserOperationRevert(json.error.message) : null;
43724
+ if (revert !== null) throw Errors.providerError(rpcProviderRole(chainId, method), method, cause, { details: boundedRevertDetails(revert, json.error.message) });
43725
+ throw rpcProviderError(method, cause, chainId);
43318
43726
  }
43319
43727
  if (json.result === void 0) throw rpcProviderError(method, "missing result", chainId);
43320
43728
  return json.result;
@@ -43618,10 +44026,14 @@ async function buildSponsoredSafeUserOp(input) {
43618
44026
  maxPriorityFeePerGas: toHex(fees.maxPriorityFeePerGas),
43619
44027
  signature: safe4337StubSignature()
43620
44028
  };
43621
- request = await sponsorUserOperation({
43622
- chainId,
43623
- userOp: request
43624
- });
44029
+ try {
44030
+ request = await sponsorUserOperation({
44031
+ chainId,
44032
+ userOp: request
44033
+ });
44034
+ } catch (error) {
44035
+ throw typedSponsorshipFailure(error);
44036
+ }
43625
44037
  if (request.paymaster === void 0 || request.paymasterData === void 0) throw Errors.providerError("account-abstraction", "sponsorUserOperation", "missing paymaster sponsorship");
43626
44038
  const userOp = {
43627
44039
  sender,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/mcp",
3
- "version": "2.5.3",
3
+ "version": "2.5.5",
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,12 +47,12 @@
47
47
  "typescript": "npm:@typescript/typescript6@6.0.2",
48
48
  "vite": "npm:@voidzero-dev/vite-plus-core@0.1.23",
49
49
  "vite-plus": "0.1.23",
50
- "@capxul/backend": "0.2.10",
50
+ "@capxul/backend": "0.2.12",
51
51
  "@capxul/config": "0.2.1",
52
- "@capxul/sdk": "2.5.3",
52
+ "@capxul/sdk": "2.5.5",
53
53
  "@capxul/types": "0.2.1",
54
- "@capxul/typescript-config": "0.0.0",
55
- "@capxul/wire": "0.5.1"
54
+ "@capxul/wire": "0.5.1",
55
+ "@capxul/typescript-config": "0.0.0"
56
56
  },
57
57
  "scripts": {
58
58
  "dev": "vp exec tsx src/main.ts serve",