@capxul/mcp 4.20.0-beta.37 → 4.20.0-beta.39

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/main.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { i as __exportAll, o as __require, r as __commonJSMin, s as __toESM } from "./lib-DnmstTkB.mjs";
3
- import { $ as deserializeCapxulError, $n as readField, $t as ORGANIZATION_SETUP_REASONS, A as convexCallErrorFromCapxul, An as size, At as oauthBearerAuthClient, Bn as redactSecrets, Bt as CLI_CAPABILITIES, C as PonderIndexerAdapter, Cn as numberToHex$1, Ct as runPortEffect, D as TelemetryPortTag, Dn as hexToNumber, Dt as formatTraceparent, E as AccountReadPortTag, En as hexToBigInt, Et as toCapxulResult, F as makeDestinationsMethods, Fn as isEvmAddress, Ft as observationRequestHeaders, G as toPublicError, Gn as AuthClientError, Gt as MCP_EXPECTED_OUTCOME_EVENT_NAME, H as BASE_SEPOLIA_CHAIN_ID, Hn as isCredentialField, Ht as CLI_INVOCATION_KINDS, I as makeCheckoutMethods, In as toAddress, It as attachInvocationObservation, J as observeFailedResult, Jn as globalLocalStorage, Jt as normalizeCapxulOperation, K as failureDetail$1, Kn as AuthClientPortTag, Kt as CAPXUL_OPERATIONS, L as makeTargetsMethods, Ln as absurd, Lt as copyInvocationObservation, M as makeApprovalsMethods, Mn as DurationMsSchema, Mt as ClockPortTag, N as makeAccountMethods, Nn as EpochMsSchema, Nt as BetterAuthNodeLayer, O as ConvexCallError, On as trim$1, Ot as ActorFailure, P as makePaymentsMethods, Pn as ChainIdSchema, Pt as BetterAuthBrowserLayer, Q as version$2, Qn as isRecord, Qt as setups, R as makeVerificationMethods, Rn as getFunctionName, Rt as readInvocationObservation, S as makeHoldingsMethods, Sn as bytesToHex, St as runIdentityFacade, T as ConvexAccountLayer, Tn as toHex, Tt as runCapxulEffect, U as callOperation, Un as toAllowedOrigin, Ut as FAILURE_CLASSES, V as normalizeSafeSaltEmail, Vn as redactUrlSecrets, Vt as CLI_COMMAND_NAMES, W as asCapxulError, Wn as toPublishableKey, Wt as EXCEPTION_EVENT_NAME, X as withCapturedAttemptContext, Xn as toAuthUserId, Xt as details, Y as observeSdkClient, Yn as toEpochMs, Yt as OPERATIONS, Z as failureProperties, Zn as toEmail, Zt as onboardings, _ as makeActivityMethods, _n as concatHex, _t as validateHandle, an as diagnostics, ar as httpStatusMode, at as isEcdsaSignatureHex, b as ConvexSmartAccountLayer, bn as keccak256$1, bt as noSessionError, c as OrgPortTag, cn as isBytes32, cr as FAILURE_MODES, ct as recoverRawDigestSigner, dn as toRlp, dt as makeCurrentUserMethods, en as ORGANIZATION_SETUP_STATUSES, er as AuthCachePortTag, et as maskedMessage, fn as publicKeyToAddress, ft as makeClientRequestMethods, g as makeMeMethods, gn as concat, gt as toHandle, h as bootIdentityFlow, hn as slice, ht as toTesterKind, in as toOrgId, ir as PROVIDER_PROBLEMS, it as httpStatusOf, j as bindProductTelemetryInvocation, jn as isHex, jt as SystemClockLayer, k as ConvexCallPortTag, kn as BaseError, kt as carryInvocationParentSpan, ln as hashTypedData, lr as isFailureMode, lt as signerFailure, m as executeIdentityProductObservation, mn as createCursor, mt as toKycTier, n as makeOrgMethods, nn as CAPXUL_ERROR_CODES, nr as providerStatusFailure, nt as UNOBSERVABLE_SIGNER_STATUS, on as AppIdSchema, or as CapxulError, ot as isSignerNotReadySignal, pn as formatGwei$1, pt as toCountryCode, q as failureEvidenceProps, qn as detectAuthCacheAdapter, qt as isCapxulOperation, r as makeBankingMethods, rn as isExpectedOutcome, rr as PROVIDERS, rt as causeChain, s as ConvexOrganizationAdapter, sn as images, sr as isCapxulError, st as openfortSignerNotReadyCode, t as ConvexOrganizationSetupAdapter, tn as decodeChainCause, tr as Errors, tt as serializeCapxulError, un as sha256, ut as signerPathFailure, v as makePaymentDocumentsMethods, vn as isAddress, vt as makeAuthMethods, w as makeAccountsMethods, wn as stringToHex, wt as sessionFromActor, x as SmartAccountPortTag, xn as hexToBytes, xt as publicIdentityFailure, y as makeSmartAccountMethods, yn as InvalidAddressError, yt as askIdentity, z as withheld, zn as sanitizeObservationContext, zt as redactTelemetryProps } from "./organizations-CQzoDh5i.mjs";
3
+ import { $ as deserializeCapxulError, $n as readField, $t as ORGANIZATION_SETUP_REASONS, A as convexCallErrorFromCapxul, An as size, At as oauthBearerAuthClient, Bn as redactSecrets, Bt as CLI_CAPABILITIES, C as PonderIndexerAdapter, Cn as numberToHex$1, Ct as runPortEffect, D as TelemetryPortTag, Dn as hexToNumber, Dt as formatTraceparent, E as AccountReadPortTag, En as hexToBigInt, Et as toCapxulResult, F as makeDestinationsMethods, Fn as isEvmAddress, Ft as observationRequestHeaders, G as toPublicError, Gn as AuthClientError, Gt as MCP_EXPECTED_OUTCOME_EVENT_NAME, H as BASE_SEPOLIA_CHAIN_ID, Hn as isCredentialField, Ht as CLI_INVOCATION_KINDS, I as makeCheckoutMethods, In as toAddress, It as attachInvocationObservation, J as observeFailedResult, Jn as globalLocalStorage, Jt as normalizeCapxulOperation, K as failureDetail$1, Kn as AuthClientPortTag, Kt as CAPXUL_OPERATIONS, L as makeTargetsMethods, Ln as absurd, Lt as copyInvocationObservation, M as makeApprovalsMethods, Mn as DurationMsSchema, Mt as ClockPortTag, N as makeAccountMethods, Nn as EpochMsSchema, Nt as BetterAuthNodeLayer, O as ConvexCallError, On as trim$1, Ot as ActorFailure, P as makePaymentsMethods, Pn as ChainIdSchema, Pt as BetterAuthBrowserLayer, Q as version$2, Qn as isRecord, Qt as setups, R as makeVerificationMethods, Rn as getFunctionName, Rt as readInvocationObservation, S as makeHoldingsMethods, Sn as bytesToHex, St as runIdentityFacade, T as ConvexAccountLayer, Tn as toHex, Tt as runCapxulEffect, U as callOperation, Un as toAllowedOrigin, Ut as FAILURE_CLASSES, V as normalizeSafeSaltEmail, Vn as redactUrlSecrets, Vt as CLI_COMMAND_NAMES, W as asCapxulError, Wn as toPublishableKey, Wt as EXCEPTION_EVENT_NAME, X as withCapturedAttemptContext, Xn as toAuthUserId, Xt as details, Y as observeSdkClient, Yn as toEpochMs, Yt as OPERATIONS, Z as failureProperties, Zn as toEmail, Zt as onboardings, _ as makeActivityMethods, _n as concatHex, _t as validateHandle, an as diagnostics, ar as httpStatusMode, at as isEcdsaSignatureHex, b as ConvexSmartAccountLayer, bn as keccak256$1, bt as noSessionError, c as OrgPortTag, cn as isBytes32, cr as FAILURE_MODES, ct as recoverRawDigestSigner, dn as toRlp, dt as makeCurrentUserMethods, en as ORGANIZATION_SETUP_STATUSES, er as AuthCachePortTag, et as maskedMessage, fn as publicKeyToAddress, ft as makeClientRequestMethods, g as makeMeMethods, gn as concat, gt as toHandle, h as bootIdentityFlow, hn as slice, ht as toTesterKind, in as toOrgId, ir as PROVIDER_PROBLEMS, it as httpStatusOf, j as bindProductTelemetryInvocation, jn as isHex, jt as SystemClockLayer, k as ConvexCallPortTag, kn as BaseError, kt as carryInvocationParentSpan, ln as hashTypedData, lr as isFailureMode, lt as signerFailure, m as executeIdentityProductObservation, mn as createCursor, mt as toKycTier, n as makeOrgMethods, nn as CAPXUL_ERROR_CODES, nr as providerStatusFailure, nt as UNOBSERVABLE_SIGNER_STATUS, on as AppIdSchema, or as CapxulError, ot as isSignerNotReadySignal, pn as formatGwei$1, pt as toCountryCode, q as failureEvidenceProps, qn as detectAuthCacheAdapter, qt as isCapxulOperation, r as makeBankingMethods, rn as isExpectedOutcome, rr as PROVIDERS, rt as causeChain, s as ConvexOrganizationAdapter, sn as images, sr as isCapxulError, st as openfortSignerNotReadyCode, t as ConvexOrganizationSetupAdapter, tn as decodeChainCause, tr as Errors, tt as serializeCapxulError, un as sha256, ut as signerPathFailure, v as makePaymentDocumentsMethods, vn as isAddress, vt as makeAuthMethods, w as makeAccountsMethods, wn as stringToHex, wt as sessionFromActor, x as SmartAccountPortTag, xn as hexToBytes, xt as publicIdentityFailure, y as makeSmartAccountMethods, yn as InvalidAddressError, yt as askIdentity, z as withheld, zn as sanitizeObservationContext, zt as redactTelemetryProps } from "./organizations-DLp8ddZI.mjs";
4
4
  import { t as secp256k1 } from "./secp256k1-vkvPWdOZ.mjs";
5
5
  import { t as require_lib } from "./lib-CoGPQsbr.mjs";
6
6
  import { serveStdio } from "@modelcontextprotocol/server/stdio";
@@ -39759,7 +39759,7 @@ async function createCapxulClient(input) {
39759
39759
  }
39760
39760
  //#endregion
39761
39761
  //#region package.json
39762
- var version = "4.20.0-beta.37";
39762
+ var version = "4.20.0-beta.39";
39763
39763
  //#endregion
39764
39764
  //#region src/failure-report.ts
39765
39765
  /**
@@ -40503,6 +40503,103 @@ function toolCallNames(body) {
40503
40503
  return names;
40504
40504
  }
40505
40505
  //#endregion
40506
+ //#region src/request-body.ts
40507
+ /**
40508
+ * The gate must read the body before the handler does, so the size limit lives
40509
+ * here. `CAPXUL_MCP_HOST` can bind this server off loopback, and a JSON-RPC
40510
+ * request that needs more than this is not one of ours.
40511
+ */
40512
+ const MAX_BODY_BYTES = 1048576;
40513
+ const TOO_LARGE = Symbol("body-too-large");
40514
+ /**
40515
+ * How long a body may take to arrive in full. The size limit alone does not
40516
+ * bound a slow client: a trickle below it would hold the socket until Node's
40517
+ * own request timeout, minutes later. A whole 1 MiB body still fits at about
40518
+ * 35 KiB/s.
40519
+ */
40520
+ const BODY_DEADLINE_MS = 3e4;
40521
+ const TIMED_OUT = Symbol("body-timed-out");
40522
+ /**
40523
+ * Reads the body with listeners rather than `for await`: leaving that loop
40524
+ * early destroys the request, and the client would see a reset instead of the
40525
+ * 413 or 408. Past the limit or the deadline this stops listening and leaves
40526
+ * the stream to the caller.
40527
+ */
40528
+ function readJsonBody(req, deadlineMs = BODY_DEADLINE_MS) {
40529
+ return new Promise((resolve, reject) => {
40530
+ const chunks = [];
40531
+ let size = 0;
40532
+ const settle = (finish) => {
40533
+ clearTimeout(deadline);
40534
+ req.off("data", onData);
40535
+ req.off("end", onEnd);
40536
+ req.off("error", onError);
40537
+ req.off("close", onClose);
40538
+ finish();
40539
+ };
40540
+ const onData = (chunk) => {
40541
+ const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
40542
+ size += buffer.length;
40543
+ if (size > MAX_BODY_BYTES) return settle(() => resolve(TOO_LARGE));
40544
+ chunks.push(buffer);
40545
+ };
40546
+ const onEnd = () => settle(() => resolve(parseJsonBody(chunks)));
40547
+ const onError = (cause) => settle(() => reject(cause));
40548
+ const onClose = () => settle(() => reject(/* @__PURE__ */ new Error("request closed before its body ended")));
40549
+ const deadline = setTimeout(() => settle(() => resolve(TIMED_OUT)), deadlineMs);
40550
+ req.on("data", onData);
40551
+ req.on("end", onEnd);
40552
+ req.on("error", onError);
40553
+ req.on("close", onClose);
40554
+ });
40555
+ }
40556
+ /**
40557
+ * How much of an oversized body the 413 path reads and discards before it
40558
+ * gives up on the connection: one more limit's worth, for at most five
40559
+ * seconds. A slow client cannot hold the socket longer than this.
40560
+ */
40561
+ const MAX_DRAIN_BYTES = MAX_BODY_BYTES;
40562
+ const MAX_DRAIN_MS = 5e3;
40563
+ /**
40564
+ * Discards the rest of a body `readJsonBody` gave up on. `drained`: it ended
40565
+ * within the bound. `abandoned`: it did not, and the connection must close.
40566
+ * `gone`: the client closed it first, so nothing can be answered.
40567
+ */
40568
+ function drainRest(req) {
40569
+ if (req.readableEnded) return Promise.resolve("drained");
40570
+ if (req.destroyed) return Promise.resolve("gone");
40571
+ return new Promise((resolve) => {
40572
+ let size = 0;
40573
+ const settle = (outcome) => {
40574
+ clearTimeout(deadline);
40575
+ req.off("data", onData);
40576
+ req.off("end", onEnd);
40577
+ req.off("error", onGone);
40578
+ req.off("close", onGone);
40579
+ resolve(outcome);
40580
+ };
40581
+ const onData = (chunk) => {
40582
+ size += Buffer.byteLength(chunk);
40583
+ if (size > MAX_DRAIN_BYTES) settle("abandoned");
40584
+ };
40585
+ const onEnd = () => settle("drained");
40586
+ const onGone = () => settle("gone");
40587
+ const deadline = setTimeout(() => settle("abandoned"), MAX_DRAIN_MS);
40588
+ req.on("data", onData);
40589
+ req.on("end", onEnd);
40590
+ req.on("error", onGone);
40591
+ req.on("close", onGone);
40592
+ });
40593
+ }
40594
+ function parseJsonBody(chunks) {
40595
+ if (chunks.length === 0) return void 0;
40596
+ try {
40597
+ return JSON.parse(Buffer.concat(chunks).toString("utf8"));
40598
+ } catch {
40599
+ return;
40600
+ }
40601
+ }
40602
+ //#endregion
40506
40603
  //#region src/deps.ts
40507
40604
  const NO_IDENTITY = async () => void 0;
40508
40605
  function makeRequestScope(deps, source = NO_IDENTITY) {
@@ -40645,45 +40742,62 @@ const LOOPBACK_HOSTS = /* @__PURE__ */ new Set([
40645
40742
  "::1",
40646
40743
  "localhost"
40647
40744
  ]);
40745
+ /**
40746
+ * Node's own bound on receiving a whole request, headers included. The body
40747
+ * deadline answers `/mcp` first; this closes the requests that path never
40748
+ * reads, such as a body sent to a 404 or 405, which Node otherwise drains for
40749
+ * its five-minute default. Node checks it every `connectionsCheckingInterval`.
40750
+ */
40751
+ const REQUEST_TIMEOUT_MS = 45e3;
40752
+ const CONNECTIONS_CHECKING_INTERVAL_MS = 5e3;
40648
40753
  async function startHttpServer(input) {
40649
- const httpServer = createServer();
40754
+ const httpServer = createServer({
40755
+ requestTimeout: REQUEST_TIMEOUT_MS,
40756
+ connectionsCheckingInterval: CONNECTIONS_CHECKING_INTERVAL_MS
40757
+ });
40650
40758
  await new Promise((resolve, reject) => {
40651
40759
  httpServer.once("error", reject);
40652
40760
  httpServer.listen(input.port, input.host, resolve);
40653
40761
  });
40654
40762
  const address = httpServer.address();
40655
40763
  const port = typeof address === "object" && address !== null ? address.port : input.port;
40656
- const resource = readResourceEnvConfig(port, input.env ?? process.env);
40657
- const identities = makeIdentityResolver({
40658
- exchange: resource.exchange,
40659
- ...input.fetch === void 0 ? {} : { fetch: input.fetch },
40660
- ...input.now === void 0 ? {} : { now: input.now }
40661
- });
40662
- const handler = createHandler({
40663
- deps: input.deps,
40664
- identityForToken: (token) => identities.peek(token)
40665
- });
40666
- const mcp = toNodeHandler(handler);
40667
- const guards = LOOPBACK_HOSTS.has(input.host) ? [localhostHostValidation(), localhostOriginValidation()] : [];
40668
- httpServer.on("request", (req, res) => {
40669
- handle({
40670
- req,
40671
- res,
40672
- resource,
40673
- identities,
40674
- mcp,
40675
- guards,
40676
- deps: input.deps
40677
- }).catch((cause) => {
40678
- if (!res.headersSent) writeJson(res, 500, { error: "internal_error" });
40679
- console.error("[capxul-mcp] request failed:", cause);
40680
- reportRequestFailure(input.deps, cause);
40764
+ try {
40765
+ const resource = readResourceEnvConfig(port, input.env ?? process.env);
40766
+ const identities = makeIdentityResolver({
40767
+ exchange: resource.exchange,
40768
+ ...input.fetch === void 0 ? {} : { fetch: input.fetch },
40769
+ ...input.now === void 0 ? {} : { now: input.now }
40681
40770
  });
40682
- });
40683
- return {
40684
- port,
40685
- close: () => closeHttpServer(httpServer, handler)
40686
- };
40771
+ const handler = createHandler({
40772
+ deps: input.deps,
40773
+ identityForToken: (token) => identities.peek(token)
40774
+ });
40775
+ const mcp = toNodeHandler(handler);
40776
+ const guards = LOOPBACK_HOSTS.has(input.host) ? [localhostHostValidation(), localhostOriginValidation()] : [];
40777
+ httpServer.on("request", (req, res) => {
40778
+ handle({
40779
+ req,
40780
+ res,
40781
+ resource,
40782
+ identities,
40783
+ mcp,
40784
+ guards,
40785
+ deps: input.deps,
40786
+ bodyDeadlineMs: input.bodyDeadlineMs
40787
+ }).catch((cause) => {
40788
+ if (!res.headersSent) writeJson(res, 500, { error: "internal_error" });
40789
+ console.error("[capxul-mcp] request failed:", cause);
40790
+ reportRequestFailure(input.deps, cause);
40791
+ });
40792
+ });
40793
+ return {
40794
+ port,
40795
+ close: () => closeHttpServer(httpServer, handler)
40796
+ };
40797
+ } catch (cause) {
40798
+ await closeListener(httpServer);
40799
+ throw cause;
40800
+ }
40687
40801
  }
40688
40802
  async function handle(input) {
40689
40803
  const { req, res } = input;
@@ -40695,8 +40809,25 @@ async function handle(input) {
40695
40809
  }
40696
40810
  if (url.pathname !== "/mcp") return writeJson(res, 404, { error: "not_found" });
40697
40811
  if (req.method !== "POST") return writeMethodNotAllowed(res, "POST");
40698
- const body = await readJsonBody(req);
40699
- if (body === TOO_LARGE) return writeJson(res, 413, { error: "payload_too_large" });
40812
+ const body = await readJsonBody(req, input.bodyDeadlineMs);
40813
+ if (body === TIMED_OUT) {
40814
+ res.writeHead(408, {
40815
+ "Content-Type": "application/json",
40816
+ Connection: "close"
40817
+ });
40818
+ res.end(JSON.stringify({ error: "request_timeout" }));
40819
+ return;
40820
+ }
40821
+ if (body === TOO_LARGE) {
40822
+ const rest = await drainRest(req);
40823
+ if (rest === "gone") return;
40824
+ res.writeHead(413, {
40825
+ "Content-Type": "application/json",
40826
+ ...rest === "abandoned" ? { Connection: "close" } : {}
40827
+ });
40828
+ res.end(JSON.stringify({ error: "payload_too_large" }));
40829
+ return;
40830
+ }
40700
40831
  const decision = await authorize({
40701
40832
  body,
40702
40833
  authorization: headerValue(req, "authorization"),
@@ -40765,29 +40896,6 @@ function protectedResourceMetadata(resource) {
40765
40896
  scopes_supported: [...AGENT_SCOPES]
40766
40897
  };
40767
40898
  }
40768
- /**
40769
- * The gate must read the body before the handler does, so the size limit lives
40770
- * here. `CAPXUL_MCP_HOST` can bind this server off loopback, and a JSON-RPC
40771
- * request that needs more than this is not one of ours.
40772
- */
40773
- const MAX_BODY_BYTES = 1048576;
40774
- const TOO_LARGE = Symbol("body-too-large");
40775
- async function readJsonBody(req) {
40776
- const chunks = [];
40777
- let size = 0;
40778
- for await (const chunk of req) {
40779
- const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
40780
- size += buffer.length;
40781
- if (size > MAX_BODY_BYTES) return TOO_LARGE;
40782
- chunks.push(buffer);
40783
- }
40784
- if (chunks.length === 0) return void 0;
40785
- try {
40786
- return JSON.parse(Buffer.concat(chunks).toString("utf8"));
40787
- } catch {
40788
- return;
40789
- }
40790
- }
40791
40899
  function headerValue(req, name) {
40792
40900
  const value = req.headers[name];
40793
40901
  return Array.isArray(value) ? value[0] : value;
@@ -40805,6 +40913,9 @@ function writeJson(res, status, body) {
40805
40913
  }
40806
40914
  async function closeHttpServer(server, handler) {
40807
40915
  await handler.close();
40916
+ await closeListener(server);
40917
+ }
40918
+ async function closeListener(server) {
40808
40919
  await new Promise((resolve, reject) => {
40809
40920
  server.close((error) => error === void 0 ? resolve() : reject(error));
40810
40921
  server.closeAllConnections();
@@ -404,9 +404,11 @@ const Errors = {
404
404
  * internal state machine. `currentState` is the Effect-machine snapshot
405
405
  * tag (stringified from the SDK's actor-shell snapshot; see
406
406
  * `packages/errors/CONTEXT.md`); `validStates`
407
- * enumerates the states the method accepts.
407
+ * enumerates the states the method accepts that the target can still reach.
408
+ * An empty list means the target is final, and the message says so instead
409
+ * of listing states.
408
410
  */
409
- wrongState: (details) => new CapxulError("WRONG_STATE", `${details.method} called from state '${details.currentState}'; valid states: ${details.validStates.join(", ")}`, { details: {
411
+ wrongState: (details) => new CapxulError("WRONG_STATE", details.validStates.length === 0 ? `${details.method} called from state '${details.currentState}'; it can no longer move to any state` : `${details.method} called from state '${details.currentState}'; valid states: ${details.validStates.join(", ")}`, { details: {
410
412
  method: details.method,
411
413
  currentState: details.currentState,
412
414
  validStates: [...details.validStates],
@@ -2160,6 +2162,8 @@ const Payment = Schema.Struct({
2160
2162
  notSent: Schema.optionalKey(Schema.Literal(true))
2161
2163
  })),
2162
2164
  requestedOutput: Schema.optionalKey(MoneySchema),
2165
+ /** What Bridge reports reached the recipient's bank. Present once delivery is done. */
2166
+ deliveredOutput: Schema.optionalKey(MoneySchema),
2163
2167
  outputExact: Schema.optionalKey(Schema.Boolean),
2164
2168
  recipientOnCapxul: Schema.optionalKey(Schema.Boolean),
2165
2169
  recipientWarning: Schema.optionalKey(Schema.Boolean),
@@ -2179,7 +2183,7 @@ const Payment = Schema.Struct({
2179
2183
  })),
2180
2184
  createdAt: EpochMsSchema$1,
2181
2185
  updatedAt: EpochMsSchema$1
2182
- }).pipe(Schema.check(Schema.makeFilter((payment) => payment.documents.every((document) => document.role !== "instruction" || document.kind === "memo" || paymentTypeForDocumentKind(document.kind) === payment.paymentType), { message: "document kind must map to paymentType" }), Schema.makeFilter((payment) => payment.recipient.kind === "party_account" ? payment.requestedOutput !== void 0 && payment.outputExact !== void 0 && payment.recipientOnCapxul !== void 0 && payment.recipientWarning !== void 0 && payment.links !== void 0 && payment.legs?.length === 2 && payment.legs[0]?.kind === "funding" && payment.legs[1]?.kind === "delivery" : payment.requestedOutput === void 0 && payment.outputExact === void 0 && payment.recipientOnCapxul === void 0 && payment.recipientWarning === void 0 && payment.links === void 0 && payment.legs === void 0, { message: "Bank payout Payments require their quote, output and two rail legs" })));
2186
+ }).pipe(Schema.check(Schema.makeFilter((payment) => payment.documents.every((document) => document.role !== "instruction" || document.kind === "memo" || paymentTypeForDocumentKind(document.kind) === payment.paymentType), { message: "document kind must map to paymentType" }), Schema.makeFilter((payment) => payment.recipient.kind === "party_account" ? payment.requestedOutput !== void 0 && payment.outputExact !== void 0 && payment.recipientOnCapxul !== void 0 && payment.recipientWarning !== void 0 && payment.links !== void 0 && payment.legs?.length === 2 && payment.legs[0]?.kind === "funding" && payment.legs[1]?.kind === "delivery" : payment.requestedOutput === void 0 && payment.deliveredOutput === void 0 && payment.outputExact === void 0 && payment.recipientOnCapxul === void 0 && payment.recipientWarning === void 0 && payment.links === void 0 && payment.legs === void 0, { message: "Bank payout Payments require their quote, output and two rail legs" })));
2183
2187
  //#endregion
2184
2188
  //#region ../../packages/protocol/src/payments/model.ts
2185
2189
  function toPaymentId(raw) {
@@ -2784,6 +2788,8 @@ const PaymentQuoteSchema = Schema.Struct({
2784
2788
  requestedOutput: MoneySchema,
2785
2789
  outputExact: Schema.Boolean,
2786
2790
  funding: AssetAmountSchema,
2791
+ /** The part of `funding` that covers rate movement before the transfer is funded. */
2792
+ slippage: Schema.optionalKey(AssetAmountSchema),
2787
2793
  expiresAt: Schema.Finite,
2788
2794
  recipient: Schema.Struct({
2789
2795
  label: Schema.String,
@@ -17733,7 +17739,7 @@ function causeFromSummary(links) {
17733
17739
  }
17734
17740
  //#endregion
17735
17741
  //#region ../../packages/sdk/package.json
17736
- var version$1 = "4.20.0-beta.37";
17742
+ var version$1 = "4.20.0-beta.39";
17737
17743
  //#endregion
17738
17744
  //#region ../../packages/sdk/src/observability/telemetry/exception-projection.ts
17739
17745
  /** Fixed fallback for failures that have no safe message. */
@@ -26200,7 +26206,7 @@ function makeApprovalsMethods(deps) {
26200
26206
  const signal = options?.signal;
26201
26207
  if (isCommandApproval(input)) return openApproval(signal, (signerAddress) => prepareVerifiedCommand(deps, input, signerAddress, signal));
26202
26208
  if (isPermissionChange(input)) return openApproval(signal, async (signerAddress) => {
26203
- const { prepareVerifiedPermissionChange } = await import("./permission-approvals-COFV61rL.mjs");
26209
+ const { prepareVerifiedPermissionChange } = await import("./permission-approvals-Co_RwJB1.mjs");
26204
26210
  return prepareVerifiedPermissionChange(deps, input, signerAddress, signal);
26205
26211
  });
26206
26212
  if ("organizationId" in input) return checkedBankApproval(deps, input, await openApproval(signal, (signerAddress) => prepareVerifiedOrganizationPayment(deps, input, signerAddress, signal)));
@@ -1,4 +1,4 @@
1
- import { B as abandonPrepared, Kt as CAPXUL_OPERATIONS, Ln as absurd, W as asCapxulError, a as prepareConfiguration, bt as noSessionError, d as verifiedPreparation, f as buildCommand, i as authorInvitation, l as preparePermission, o as verifiedConfiguration, or as CapxulError, p as validateReplacementInput, u as preparedIdentity } from "./organizations-CQzoDh5i.mjs";
1
+ import { B as abandonPrepared, Kt as CAPXUL_OPERATIONS, Ln as absurd, W as asCapxulError, a as prepareConfiguration, bt as noSessionError, d as verifiedPreparation, f as buildCommand, i as authorInvitation, l as preparePermission, o as verifiedConfiguration, or as CapxulError, p as validateReplacementInput, u as preparedIdentity } from "./organizations-DLp8ddZI.mjs";
2
2
  //#region ../../packages/sdk/src/accounts/permission-approvals.ts
3
3
  /** Prepare a Permission write or an invitation's configuration for `signerAddress`, checked. */
4
4
  function prepareVerifiedPermissionChange(deps, input, signerAddress, signal) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/mcp",
3
- "version": "4.20.0-beta.37",
3
+ "version": "4.20.0-beta.39",
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": [
@@ -54,9 +54,9 @@
54
54
  "typescript": "npm:@typescript/typescript6@6.0.2",
55
55
  "vite": "npm:@voidzero-dev/vite-plus-core@1.0.0",
56
56
  "vite-plus": "1.0.0",
57
- "@capxul/observability": "4.20.0-beta.37",
57
+ "@capxul/observability": "4.20.0-beta.39",
58
58
  "@capxul/protocol": "0.2.0-beta.8",
59
- "@capxul/sdk": "4.20.0-beta.37",
59
+ "@capxul/sdk": "4.20.0-beta.39",
60
60
  "@capxul/typescript-config": "0.0.0"
61
61
  },
62
62
  "scripts": {