@mysten-incubation/suipay-mcp 0.3.0-dev.0 → 0.3.0-dev.1

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/README.md CHANGED
@@ -5,7 +5,7 @@ buyer-funded spend account. The buyer owns the account. The agent holds the
5
5
  delegate key and can spend only under the on-chain grant (recipient bind,
6
6
  per-payment cap, budget).
7
7
 
8
- Pin `@mysten-incubation/suipay-mcp@0.3.0-dev.0` in MCP config for the `latest` dist-tag.
8
+ Pin `@mysten-incubation/suipay-mcp@0.3.0-dev.1` in MCP config for the `latest` dist-tag.
9
9
  `npx -y @mysten-incubation/suipay-mcp@dev` tracks the `dev` prerelease line.
10
10
  `1.0.1` remains on the registry as a historical release; do not install it
11
11
  for new agents.
@@ -13,7 +13,7 @@ for new agents.
13
13
  ## Install
14
14
 
15
15
  ```bash
16
- claude mcp add --scope user suipay -- npx -y @mysten-incubation/suipay-mcp@0.3.0-dev.0
16
+ claude mcp add --scope user suipay -- npx -y @mysten-incubation/suipay-mcp@0.3.0-dev.1
17
17
  ```
18
18
 
19
19
  `@dev` installs the Railway-dev gateway/console defaults. A workspace
@@ -155,10 +155,10 @@ Default is Railway **suipay-dev**. `--local` / `target: "local"` is laptop-only.
155
155
 
156
156
  ```bash
157
157
  # Railway suipay-dev (default)
158
- npx @mysten-incubation/suipay-mcp@0.3.0-dev.0
158
+ npx @mysten-incubation/suipay-mcp@0.3.0-dev.1
159
159
 
160
160
  # Laptop stack
161
- npx @mysten-incubation/suipay-mcp@0.3.0-dev.0 --local
161
+ npx @mysten-incubation/suipay-mcp@0.3.0-dev.1 --local
162
162
  ```
163
163
 
164
164
  `SUIPAY_MCP_TARGET=local|dev` selects the same preset. Explicit
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  main
4
- } from "../chunk-47YNZDCC.js";
4
+ } from "../chunk-L7OTT6U5.js";
5
5
  import {
6
6
  logError
7
- } from "../chunk-CXM7PELK.js";
7
+ } from "../chunk-WPRFEMBU.js";
8
8
 
9
9
  // src/bin/suipay.ts
10
10
  main().catch((err) => {
@@ -5,7 +5,7 @@ import {
5
5
  loadMcpConfig,
6
6
  loadPaymentProfile,
7
7
  logError
8
- } from "./chunk-CXM7PELK.js";
8
+ } from "./chunk-WPRFEMBU.js";
9
9
 
10
10
  // src/index.ts
11
11
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
@@ -4915,7 +4915,7 @@ var SERVICE_CODES = {
4915
4915
  },
4916
4916
  // Boot or configuration fell back to a degraded mode instead of failing.
4917
4917
  "service.config_degraded": {
4918
- surfaces: ["gateway"],
4918
+ surfaces: ["gateway", "console_server"],
4919
4919
  status: null,
4920
4920
  title: "Service started with degraded configuration",
4921
4921
  paymentState: "not_charged",
@@ -4935,6 +4935,39 @@ var SERVICE_CODES = {
4935
4935
  nextAction: "none",
4936
4936
  user: null,
4937
4937
  logOnly: true
4938
+ },
4939
+ // What a process started with: network, posture, rails, gas pool. Healthy.
4940
+ "service.boot": {
4941
+ surfaces: ["gateway", "seller", "indexer"],
4942
+ status: null,
4943
+ title: "Service started",
4944
+ paymentState: "not_charged",
4945
+ retry: "never",
4946
+ nextAction: "none",
4947
+ user: null,
4948
+ logOnly: true
4949
+ },
4950
+ // A background worker started, stopped, swept or retried on schedule. Healthy.
4951
+ "service.lifecycle": {
4952
+ surfaces: ["gateway", "seller", "indexer"],
4953
+ status: null,
4954
+ title: "Background work progressed",
4955
+ paymentState: "not_charged",
4956
+ retry: "never",
4957
+ nextAction: "none",
4958
+ user: null,
4959
+ logOnly: true
4960
+ },
4961
+ // Detail about healthy traffic an operator may want when reading a trace.
4962
+ "service.diagnostic": {
4963
+ surfaces: ["gateway", "seller", "indexer"],
4964
+ status: null,
4965
+ title: "Diagnostic detail",
4966
+ paymentState: "not_charged",
4967
+ retry: "never",
4968
+ nextAction: "none",
4969
+ user: null,
4970
+ logOnly: true
4938
4971
  }
4939
4972
  };
4940
4973
 
@@ -5635,6 +5668,233 @@ function newTraceId(randomBytes3 = cryptoRandomBytes) {
5635
5668
  return /^0+$/.test(hex) ? newTraceId(randomBytes3) : hex;
5636
5669
  }
5637
5670
 
5671
+ // ../core/dist/errors/context-allowlist.js
5672
+ var CONTEXT_ALLOWLIST = /* @__PURE__ */ new Set([
5673
+ // Settlement and request identifiers.
5674
+ "txDigest",
5675
+ "digest",
5676
+ "challengeId",
5677
+ "paymentId",
5678
+ "paymentHash",
5679
+ "paymentKey",
5680
+ "paymentState",
5681
+ "requestId",
5682
+ "traceId",
5683
+ "clientId",
5684
+ "serviceId",
5685
+ "configId",
5686
+ "seedId",
5687
+ "grantId",
5688
+ "grantObjectId",
5689
+ "sameGrantObjectId",
5690
+ "verifiedGrant",
5691
+ "poolObjectId",
5692
+ "packageId",
5693
+ "activePackageId",
5694
+ "expectedPackageId",
5695
+ "actualPackageId",
5696
+ "mandateId",
5697
+ "session",
5698
+ "coinId",
5699
+ "coinIds",
5700
+ "id",
5701
+ "dedupeKey",
5702
+ "hook",
5703
+ // Addresses (public on chain).
5704
+ "owner",
5705
+ "payTo",
5706
+ "recipient",
5707
+ "delegateAddress",
5708
+ // Codes, kinds and states.
5709
+ "code",
5710
+ "innerCode",
5711
+ "requestedCode",
5712
+ "failureCode",
5713
+ "oauthError",
5714
+ "errorKind",
5715
+ "kind",
5716
+ "mode",
5717
+ "effectiveMode",
5718
+ "state",
5719
+ "outcome",
5720
+ "status",
5721
+ "httpStatus",
5722
+ "reason",
5723
+ "action",
5724
+ "stage",
5725
+ "paid",
5726
+ "delivery",
5727
+ "sellerStatus",
5728
+ "sellerCode",
5729
+ "bindingCode",
5730
+ "errorName",
5731
+ "gasStationStatus",
5732
+ "readFailure",
5733
+ "refusal",
5734
+ "refusedAs",
5735
+ "registryCode",
5736
+ "sessionDecision",
5737
+ "settleCode",
5738
+ "signedRequest",
5739
+ "signerCode",
5740
+ "consentCode",
5741
+ "publicReason",
5742
+ "details",
5743
+ "event",
5744
+ "eventType",
5745
+ "surface",
5746
+ "scope",
5747
+ "field",
5748
+ "header",
5749
+ "dependency",
5750
+ "network",
5751
+ "rails",
5752
+ "shard",
5753
+ "metric",
5754
+ "alarm",
5755
+ "alert",
5756
+ "from",
5757
+ "to",
5758
+ "expected",
5759
+ "required",
5760
+ "violated",
5761
+ "diverged",
5762
+ "replaced",
5763
+ "suppressed",
5764
+ "unknown",
5765
+ "verified",
5766
+ "verification",
5767
+ "simulation",
5768
+ "isNew",
5769
+ "needsTopup",
5770
+ "operatorCapSet",
5771
+ "wantAgent",
5772
+ "wantGrant",
5773
+ "wantPool",
5774
+ "limitedBy",
5775
+ "peer",
5776
+ // Counts, amounts and timings.
5777
+ "amount",
5778
+ "scanned",
5779
+ "deleted",
5780
+ "intents",
5781
+ "policies",
5782
+ "connections",
5783
+ "events",
5784
+ "maxQueueSize",
5785
+ "bytes",
5786
+ "sha256",
5787
+ "ts",
5788
+ "count",
5789
+ "countRaw",
5790
+ "matchingCount",
5791
+ "registry_field_count",
5792
+ "applied",
5793
+ "attempt",
5794
+ "attempts",
5795
+ "cap",
5796
+ "max",
5797
+ "maxChallenges",
5798
+ "MAX_GAS_COIN_PAGES",
5799
+ "pagesScanned",
5800
+ "size",
5801
+ "free",
5802
+ "used",
5803
+ "fill",
5804
+ "limits",
5805
+ "refills",
5806
+ "refilled",
5807
+ "split",
5808
+ "unconfirmed",
5809
+ "spent",
5810
+ "reserveAfter",
5811
+ "claimedUntilMs",
5812
+ "repaired",
5813
+ "splits",
5814
+ "spend",
5815
+ "reserve",
5816
+ "reserveBalance",
5817
+ "ownerDailyMist",
5818
+ "ownerHourlyMist",
5819
+ "ownerIdentityDailyMist",
5820
+ "delegateDailyMist",
5821
+ "delegateHourlyMist",
5822
+ "delegateIdentityDailyMist",
5823
+ "consecutiveFailures",
5824
+ "failuresInARow",
5825
+ "epochReadFailures",
5826
+ "daysRemaining",
5827
+ "deadline",
5828
+ "delay",
5829
+ "delayMs",
5830
+ "ageMs",
5831
+ "timeoutMs",
5832
+ "nowMs",
5833
+ "switchedAtMs",
5834
+ "observeUntil",
5835
+ "window",
5836
+ "checkpointSeq",
5837
+ "eventSeq",
5838
+ "sampleSubjects",
5839
+ // Operator-facing error text. Redacted and length-capped like every string.
5840
+ "error",
5841
+ "errors",
5842
+ "err",
5843
+ "lastError",
5844
+ "outcomeError",
5845
+ "detail",
5846
+ "raw",
5847
+ "value"
5848
+ ]);
5849
+ var MAX_CONTEXT_STRING = 512;
5850
+ var MAX_CONTEXT_ARRAY = 32;
5851
+ var MAX_CONTEXT_DEPTH = 4;
5852
+ function filterContext(context) {
5853
+ let dropped = 0;
5854
+ const filterValue = (value2, depth) => {
5855
+ if (typeof value2 === "bigint")
5856
+ return value2.toString();
5857
+ if (value2 === null || typeof value2 !== "object")
5858
+ return value2;
5859
+ if (depth >= MAX_CONTEXT_DEPTH) {
5860
+ dropped += 1;
5861
+ return void 0;
5862
+ }
5863
+ if (Array.isArray(value2)) {
5864
+ return value2.slice(0, MAX_CONTEXT_ARRAY).map((item) => filterValue(item, depth + 1));
5865
+ }
5866
+ if (value2 instanceof Date)
5867
+ return value2.toISOString();
5868
+ return filterObject(value2, depth + 1);
5869
+ };
5870
+ const filterObject = (object, depth) => {
5871
+ const out = {};
5872
+ for (const [key, value2] of Object.entries(object)) {
5873
+ if (!CONTEXT_ALLOWLIST.has(key)) {
5874
+ dropped += 1;
5875
+ continue;
5876
+ }
5877
+ const kept = filterValue(value2, depth);
5878
+ if (kept !== void 0)
5879
+ out[key] = kept;
5880
+ }
5881
+ return out;
5882
+ };
5883
+ const value = filterObject(context, 0);
5884
+ return { value, dropped };
5885
+ }
5886
+ function capContextStrings(value) {
5887
+ if (typeof value === "string") {
5888
+ return value.length > MAX_CONTEXT_STRING ? `${value.slice(0, MAX_CONTEXT_STRING)}\u2026` : value;
5889
+ }
5890
+ if (Array.isArray(value))
5891
+ return value.map(capContextStrings);
5892
+ if (value !== null && typeof value === "object") {
5893
+ return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, capContextStrings(v)]));
5894
+ }
5895
+ return value;
5896
+ }
5897
+
5638
5898
  // ../core/dist/errors/log.js
5639
5899
  var MAX_CAUSE_DEPTH = 5;
5640
5900
  function causeChain(error) {
@@ -5685,6 +5945,7 @@ function safeStringify(value) {
5685
5945
  function errorLogLine(context, error, now = /* @__PURE__ */ new Date()) {
5686
5946
  const wantStack = context.withStack ?? (context.httpStatus !== void 0 && context.httpStatus >= 500);
5687
5947
  const stack = wantStack && error instanceof Error && error.stack ? redactSecrets(error.stack) : void 0;
5948
+ const filtered = context.context ? filterContext(context.context) : void 0;
5688
5949
  return {
5689
5950
  level: context.level ?? "error",
5690
5951
  time: now.toISOString(),
@@ -5696,10 +5957,12 @@ function errorLogLine(context, error, now = /* @__PURE__ */ new Date()) {
5696
5957
  trace_id: context.traceId || newTraceId(),
5697
5958
  cause: error === void 0 ? [] : causeChain(error),
5698
5959
  ...stack ? { stack } : {},
5699
- ...context.context ? { context: redactValue(context.context) } : {}
5960
+ ...filtered ? { context: capContextStrings(redactValue(filtered.value)) } : {},
5961
+ ...filtered && filtered.dropped > 0 ? { context_dropped: filtered.dropped } : {}
5700
5962
  };
5701
5963
  }
5702
5964
  var stderrWriter = (line) => console.error(line);
5965
+ var lineShipper = null;
5703
5966
  function logError(context, error, write = stderrWriter) {
5704
5967
  let line;
5705
5968
  let traceId = "";
@@ -5720,6 +5983,12 @@ function logError(context, error, write = stderrWriter) {
5720
5983
  write(line);
5721
5984
  } catch {
5722
5985
  }
5986
+ if (write === stderrWriter && lineShipper) {
5987
+ try {
5988
+ lineShipper.enqueue(line, context.level ?? "error");
5989
+ } catch {
5990
+ }
5991
+ }
5723
5992
  }
5724
5993
 
5725
5994
  // ../core/dist/errors/suipay-error.js
@@ -1258,7 +1258,7 @@ declare const ERRORS: {
1258
1258
  readonly logOnly: true;
1259
1259
  };
1260
1260
  readonly 'service.config_degraded': {
1261
- readonly surfaces: readonly ["gateway"];
1261
+ readonly surfaces: readonly ["gateway", "console_server"];
1262
1262
  readonly status: null;
1263
1263
  readonly title: "Service started with degraded configuration";
1264
1264
  readonly paymentState: "not_charged";
@@ -1277,6 +1277,36 @@ declare const ERRORS: {
1277
1277
  readonly user: null;
1278
1278
  readonly logOnly: true;
1279
1279
  };
1280
+ readonly 'service.boot': {
1281
+ readonly surfaces: readonly ["gateway", "seller", "indexer"];
1282
+ readonly status: null;
1283
+ readonly title: "Service started";
1284
+ readonly paymentState: "not_charged";
1285
+ readonly retry: "never";
1286
+ readonly nextAction: "none";
1287
+ readonly user: null;
1288
+ readonly logOnly: true;
1289
+ };
1290
+ readonly 'service.lifecycle': {
1291
+ readonly surfaces: readonly ["gateway", "seller", "indexer"];
1292
+ readonly status: null;
1293
+ readonly title: "Background work progressed";
1294
+ readonly paymentState: "not_charged";
1295
+ readonly retry: "never";
1296
+ readonly nextAction: "none";
1297
+ readonly user: null;
1298
+ readonly logOnly: true;
1299
+ };
1300
+ readonly 'service.diagnostic': {
1301
+ readonly surfaces: readonly ["gateway", "seller", "indexer"];
1302
+ readonly status: null;
1303
+ readonly title: "Diagnostic detail";
1304
+ readonly paymentState: "not_charged";
1305
+ readonly retry: "never";
1306
+ readonly nextAction: "none";
1307
+ readonly user: null;
1308
+ readonly logOnly: true;
1309
+ };
1280
1310
  readonly 'limit.concurrency_exceeded': {
1281
1311
  readonly surfaces: readonly ["gateway"];
1282
1312
  readonly status: 429;
package/dist/http.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { I as handleSuipayMcpHttpRequest } from './http-15g02zyM.js';
1
+ export { I as handleSuipayMcpHttpRequest } from './http-BFEAurkF.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-CXM7PELK.js";
3
+ } from "./chunk-WPRFEMBU.js";
4
4
  export {
5
5
  handleSuipayMcpHttpRequest
6
6
  };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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-15g02zyM.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-15g02zyM.js';
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-BFEAurkF.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-BFEAurkF.js';
3
3
  import { SuiGrpcClient } from '@mysten/sui/grpc';
4
4
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
5
5
  import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  loadBootProfile,
3
3
  main
4
- } from "./chunk-47YNZDCC.js";
4
+ } from "./chunk-L7OTT6U5.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-CXM7PELK.js";
29
+ } from "./chunk-WPRFEMBU.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.0",
3
+ "version": "0.3.0-dev.1",
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": {