@mysten-incubation/suipay-mcp 0.3.0-dev.3 → 0.3.0-dev.31

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.
@@ -865,6 +865,17 @@ declare const ERRORS: {
865
865
  readonly user: null;
866
866
  readonly logOnly: true;
867
867
  };
868
+ readonly 'indexer.native_settlement_deferred': {
869
+ readonly surfaces: readonly ["indexer"];
870
+ readonly status: null;
871
+ readonly title: "Native settlement is deferred; holding the checkpoint";
872
+ readonly paymentState: "not_charged";
873
+ readonly retry: "after_delay";
874
+ readonly retryAfterSeconds: 5;
875
+ readonly nextAction: "retry_later";
876
+ readonly user: null;
877
+ readonly logOnly: true;
878
+ };
868
879
  readonly 'indexer.config_invalid': {
869
880
  readonly surfaces: readonly ["indexer"];
870
881
  readonly status: null;
@@ -1357,7 +1368,7 @@ declare const ERRORS: {
1357
1368
  };
1358
1369
  };
1359
1370
  readonly 'limit.rate_limited': {
1360
- readonly surfaces: readonly ["gateway", "console_server"];
1371
+ readonly surfaces: readonly ["gateway", "console_server", "sdk"];
1361
1372
  readonly status: 429;
1362
1373
  readonly title: "Rate limit exceeded";
1363
1374
  readonly paymentState: "not_charged";
@@ -3514,6 +3525,55 @@ declare const ERRORS: {
3514
3525
  readonly message: "That web address doesn't exist. Check the spelling and try again.";
3515
3526
  };
3516
3527
  };
3528
+ readonly 'request.recipient_changed': {
3529
+ readonly surfaces: readonly ["gateway"];
3530
+ readonly status: 409;
3531
+ readonly title: "Pay-to address changed while its registry was being checked";
3532
+ readonly paymentState: "not_charged";
3533
+ readonly retry: "never";
3534
+ readonly nextAction: "fix_request";
3535
+ readonly user: {
3536
+ readonly title: "Retry this publish";
3537
+ readonly message: "The payout address changed while its payment registry was being checked. Retry so the current address is checked.";
3538
+ };
3539
+ };
3540
+ readonly 'request.recipient_registry_invalid': {
3541
+ readonly surfaces: readonly ["gateway"];
3542
+ readonly status: 409;
3543
+ readonly title: "Payment registry does not verify for this deployment";
3544
+ readonly paymentState: "not_charged";
3545
+ readonly retry: "never";
3546
+ readonly nextAction: "fix_request";
3547
+ readonly user: {
3548
+ readonly title: "Registry does not match";
3549
+ readonly message: "The payout address's payment registry does not match this deployment. Fix it, then publish again.";
3550
+ };
3551
+ };
3552
+ readonly 'request.recipient_registry_missing': {
3553
+ readonly surfaces: readonly ["gateway"];
3554
+ readonly status: 409;
3555
+ readonly title: "Pay-to address has no payment registry";
3556
+ readonly paymentState: "not_charged";
3557
+ readonly retry: "never";
3558
+ readonly nextAction: "fix_request";
3559
+ readonly user: {
3560
+ readonly title: "Create a payment registry";
3561
+ readonly message: "This payout address has no payment registry on this network yet. Create it in the seller console, then publish again.";
3562
+ };
3563
+ };
3564
+ readonly 'request.recipient_registry_unreadable': {
3565
+ readonly surfaces: readonly ["gateway"];
3566
+ readonly status: 503;
3567
+ readonly title: "Payment registry could not be read";
3568
+ readonly paymentState: "not_charged";
3569
+ readonly retry: "after_delay";
3570
+ readonly retryAfterSeconds: 5;
3571
+ readonly nextAction: "retry_later";
3572
+ readonly user: {
3573
+ readonly title: "Registry unread";
3574
+ readonly message: "The payment registry could not be read just now. Wait a moment and try again.";
3575
+ };
3576
+ };
3517
3577
  readonly 'request.redirect_refused': {
3518
3578
  readonly surfaces: readonly ["console_server", "sdk"];
3519
3579
  readonly status: 422;
@@ -3668,7 +3728,7 @@ type CodeFor<S extends Surface> = {
3668
3728
  * prior done result is never lost when capability is unavailable.
3669
3729
  * 5. Derive payment_id_hash / terms_hash.
3670
3730
  * 6. Build the full executable pay transaction (real shared-object versions).
3671
- * 7. Validate-before-sign (built tx encodes exactly the intended pay; gas may differ).
3731
+ * 7. Validate-before-sign (intended pay plus the caller's gas authority).
3672
3732
  * 8. Sign, 9. execute, 10. complete(ledger) with terminal ok/ambiguous, settle.
3673
3733
  * x402 refuses before 3 when its offer, gas pins or epoch are missing, skips
3674
3734
  * 4, builds 6 with the offer-pinned sponsor gas, and in place of 9-10
@@ -4084,14 +4144,16 @@ interface DelegatedPayerDeps {
4084
4144
  * Current Sui epoch from the agent's own chain client (see
4085
4145
  * {@link currentEpochReader}). The x402 dialect needs it to bound the
4086
4146
  * transaction's expiration; absent or failing, x402 is refused before
4087
- * anything is reserved. MPP never calls it.
4147
+ * anything is reserved. MPP also reads it when a sponsor returns an Epoch
4148
+ * or ValidDuring expiration; legacy coin-gas None needs no epoch read.
4088
4149
  */
4089
4150
  getCurrentEpoch?: () => Promise<bigint | number>;
4090
4151
  /**
4091
4152
  * Chain identifier from the agent's own chain client (see
4092
4153
  * {@link chainIdentifierReader}). Needed only for an x402 offer that pins
4093
4154
  * `address-balance` gas (ADR-0055); absent or failing, that offer is refused
4094
- * before anything is reserved.
4155
+ * before anything is reserved. MPP prepared address-balance gas uses this
4156
+ * same independent reader to bind its ValidDuring chain.
4095
4157
  */
4096
4158
  getChainIdentifier?: () => Promise<string>;
4097
4159
  /**
@@ -4874,6 +4936,11 @@ declare const TOOLS: readonly [{
4874
4936
  readonly type: "string";
4875
4937
  readonly description: "Atomic ceiling you will spend on this call. The payment is refused, unsigned, if the offer costs more.";
4876
4938
  };
4939
+ readonly dialect: {
4940
+ readonly type: "string";
4941
+ readonly enum: readonly ["mpp", "x402"];
4942
+ readonly description: "Payment dialect to settle in when the 402 offers both. Defaults to mpp. A declared dialect the payment cannot use is refused, unsigned.";
4943
+ };
4877
4944
  };
4878
4945
  readonly required: readonly ["url"];
4879
4946
  };
@@ -4903,7 +4970,7 @@ declare const TOOLS: readonly [{
4903
4970
  };
4904
4971
  }, {
4905
4972
  readonly name: "suipay_login";
4906
- readonly description: "Mint or reuse the local delegate key (version-2, mode 0600) and return a clickable console URL immediately so the owner can bind a spend-account grant. Does not wait for the wallet. Default target is Railway suipay-dev; pass target=\"local\" (or start the binary with --local) for the laptop stack. Stdio only; hosted /mcp never holds a spendable key.";
4973
+ readonly description: "Mint or reuse the local delegate key (version-2, mode 0600) and return a clickable console URL immediately so the owner can bind a spend-account grant. Does not wait for the wallet. Uses the process-configured target; start the binary with --local for the laptop stack. A target argument cannot change an existing key binding. Stdio only; hosted /mcp never holds a spendable key.";
4907
4974
  readonly inputSchema: {
4908
4975
  readonly type: "object";
4909
4976
  readonly properties: {
@@ -4914,7 +4981,7 @@ declare const TOOLS: readonly [{
4914
4981
  readonly target: {
4915
4982
  readonly type: "string";
4916
4983
  readonly enum: readonly ["dev", "local"];
4917
- readonly description: "Where to bind the grant. Default is Railway suipay-dev. Pass \"local\" for localhost:3000 / 127.0.0.1:4340.";
4984
+ readonly description: "Optional assertion of the process target (dev or local). It cannot change the configured or stored gateway.";
4918
4985
  };
4919
4986
  readonly gatewayResourceUrl: {
4920
4987
  readonly type: "string";
@@ -4922,6 +4989,13 @@ declare const TOOLS: readonly [{
4922
4989
  };
4923
4990
  };
4924
4991
  };
4992
+ }, {
4993
+ readonly name: "suipay_login_status";
4994
+ readonly description: string;
4995
+ readonly inputSchema: {
4996
+ readonly type: "object";
4997
+ readonly properties: {};
4998
+ };
4925
4999
  }, {
4926
5000
  readonly name: "suipay_logout";
4927
5001
  readonly description: "Remove the local delegate-key credentials file. Missing file is success. Force clears a corrupt file without printing the seed.";
package/dist/http.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { I as handleSuipayMcpHttpRequest } from './http-BUaEV9I3.js';
1
+ export { I as handleSuipayMcpHttpRequest } from './http-BfRuw7wl.js';
2
2
  import '@modelcontextprotocol/sdk/server/index.js';
3
3
  import '@mysten/sui/keypairs/ed25519';
4
4
  import 'node:crypto';
package/dist/http.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  handleSuipayMcpHttpRequest
3
- } from "./chunk-HIBLRYTW.js";
3
+ } from "./chunk-XQW6WNT3.js";
4
4
  export {
5
5
  handleSuipayMcpHttpRequest
6
6
  };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { S as SpendAccountSigningRequest, P as PaidHttpRequest, D as DelegatedKeySigner, G as GetObjectJson, a as DelegatedPayerSession, b as DelegatedPayerConfig, c as DelegatedPayerDeps, d as SpendIntent, e as DelegatedPayResult, f as DelegationScope, C as CodeFor, N as NextAction, g as GrantPolicyBinding, h as PaymentAttemptLedger, O as OfferPublicKeySource, i as DelegatedPayerLog, j as PreparedSettlementTerms, X as X402PayProgress, k as Offer, M as McpConfig, l as McpAuthContext, m as McpTraceHooks, n as SpendAccountPayDeps, o as createReader } from './http-BUaEV9I3.js';
2
- export { A as AgentHeldResolver, p as AgentHeldSettlement, q as MCP_TARGET_PRESETS, r as McpEnvelope, s as McpEnvelopeEntry, t as McpServerOptions, u as McpTarget, v as McpTraceContext, w as McpTraceRuntime, x as PACKAGE_NAME, y as PreparedPayment, z as SpendAccountPrepareResult, B as SpendAccountPrepareSession, T as TOOLS, E as buildSpendAccountPayKind, F as canonicalMcpRequestId, H as createServer, I as handleSuipayMcpHttpRequest, J as inspectMcpEnvelope, K as loadMcpConfig, L as parseMcpTargetFlag, Q as prepareSpendAccountPayment, R as resetAgentHeldProcessLedger, U as resolveAgentHeldSettlement, V as resolveGrantTarget, W as resolveMcpTarget, Y as sameMcpGateway, Z as traceMcpHttpRequest, _ as verifySpendAccountPayReconstructs } from './http-BUaEV9I3.js';
3
- import { SuiGrpcClient } from '@mysten/sui/grpc';
4
1
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
2
+ import { S as SpendAccountSigningRequest, P as PaidHttpRequest, D as DelegatedKeySigner, G as GetObjectJson, a as DelegatedPayerSession, b as DelegatedPayerConfig, c as DelegatedPayerDeps, d as SpendIntent, e as DelegatedPayResult, f as DelegationScope, C as CodeFor, N as NextAction, g as GrantPolicyBinding, h as PaymentAttemptLedger, O as OfferPublicKeySource, i as DelegatedPayerLog, j as PreparedSettlementTerms, X as X402PayProgress, k as Offer, M as McpConfig, l as McpAuthContext, m as McpTraceHooks, n as SpendAccountPayDeps, o as createReader } from './http-BfRuw7wl.js';
3
+ export { A as AgentHeldResolver, p as AgentHeldSettlement, q as MCP_TARGET_PRESETS, r as McpEnvelope, s as McpEnvelopeEntry, t as McpServerOptions, u as McpTarget, v as McpTraceContext, w as McpTraceRuntime, x as PACKAGE_NAME, y as PreparedPayment, z as SpendAccountPrepareResult, B as SpendAccountPrepareSession, T as TOOLS, E as buildSpendAccountPayKind, F as canonicalMcpRequestId, H as createServer, I as handleSuipayMcpHttpRequest, J as inspectMcpEnvelope, K as loadMcpConfig, L as parseMcpTargetFlag, Q as prepareSpendAccountPayment, R as resetAgentHeldProcessLedger, U as resolveAgentHeldSettlement, V as resolveGrantTarget, W as resolveMcpTarget, Y as sameMcpGateway, Z as traceMcpHttpRequest, _ as verifySpendAccountPayReconstructs } from './http-BfRuw7wl.js';
4
+ import { SuiGrpcClient } from '@mysten/sui/grpc';
5
5
  import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
6
6
  import '@modelcontextprotocol/sdk/server/index.js';
7
7
  import 'node:crypto';
@@ -65,6 +65,8 @@ declare function loadLocalSigner(): {
65
65
  signTransaction: (txBytes: string) => Promise<string>;
66
66
  signPersonalMessage: (message: Uint8Array) => Promise<string>;
67
67
  } | null;
68
+ /** Ed25519 keypair from the persisted seed. Null when this process holds no key. */
69
+ declare function loadLocalKeypair(): Ed25519Keypair | null;
68
70
 
69
71
  /**
70
72
  * Client-side completion of an MCP prepared payment.
@@ -527,9 +529,9 @@ interface StdioLoginOptions {
527
529
  delegateAddress: string;
528
530
  publicKeyHex: string;
529
531
  };
532
+ signPersonalMessage?: (message: Uint8Array) => Promise<string>;
530
533
  label?: string;
531
534
  timeoutMs?: number;
532
- openBrowser?: boolean;
533
535
  onUrl?: (connectUrl: string) => void;
534
536
  }
535
537
  interface StartedStdioLogin {
@@ -581,6 +583,10 @@ interface ToolDeps {
581
583
  createPayer?: typeof createPayer;
582
584
  createReader?: typeof createReader;
583
585
  startStdioLogin?: typeof startStdioLogin;
586
+ loadLocalKeypair?: typeof loadLocalKeypair;
587
+ checkLiveDelegateGrant?: typeof checkLiveDelegateGrant;
588
+ bypassCache?: boolean;
589
+ cacheTtlMs?: number;
584
590
  }
585
591
  declare function pay(args: {
586
592
  url: string;
@@ -590,7 +596,27 @@ declare function pay(args: {
590
596
  fileField?: unknown;
591
597
  recipient?: unknown;
592
598
  maxAmount?: unknown;
599
+ dialect?: unknown;
593
600
  }, cfg: McpConfig, deps?: ToolDeps): Promise<ToolResult>;
601
+ type LiveGrantCheck = {
602
+ kind: 'live';
603
+ grantObjectId: string;
604
+ } | {
605
+ kind: 'ambiguous';
606
+ } | {
607
+ kind: 'absent';
608
+ } | {
609
+ kind: 'expired';
610
+ } | {
611
+ kind: 'unknown';
612
+ detail: string;
613
+ };
614
+ declare function checkLiveDelegateGrant(args: {
615
+ gatewayUrl: string;
616
+ delegateAddress: string;
617
+ signPersonalMessage: (message: Uint8Array) => Promise<string>;
618
+ fetchImpl?: typeof fetch;
619
+ }): Promise<LiveGrantCheck>;
594
620
  declare function receipts(args: {
595
621
  challengeId?: string;
596
622
  }, cfg: McpConfig, deps?: ToolDeps): Promise<ToolResult>;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  loadBootProfile,
3
3
  main
4
- } from "./chunk-OAHWW4H7.js";
4
+ } from "./chunk-U4VGOG67.js";
5
5
  import {
6
6
  MCP_TARGET_PRESETS,
7
7
  PACKAGE_NAME,
@@ -26,7 +26,7 @@ import {
26
26
  settlePreparedMcpPayment,
27
27
  traceMcpHttpRequest,
28
28
  verifySpendAccountPayReconstructs
29
- } from "./chunk-HIBLRYTW.js";
29
+ } from "./chunk-XQW6WNT3.js";
30
30
  export {
31
31
  MCP_TARGET_PRESETS,
32
32
  PACKAGE_NAME,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mysten-incubation/suipay-mcp",
3
- "version": "0.3.0-dev.3",
3
+ "version": "0.3.0-dev.31",
4
4
  "type": "module",
5
5
  "description": "SuiPay MCP — pay MPP-gated APIs from a spend-account grant with an agent-held delegate key.",
6
6
  "repository": {
@@ -42,8 +42,8 @@
42
42
  "tsup": "^8.0.0",
43
43
  "typescript": "^6.0.3",
44
44
  "vitest": "^4.1.10",
45
- "@cmdoss/suipay-sdk": "0.1.0",
46
- "@cmdoss/suipay-core": "0.1.0"
45
+ "@cmdoss/suipay-core": "0.1.0",
46
+ "@cmdoss/suipay-sdk": "0.1.0"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsup",