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

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.2` 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.2
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.2
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.2 --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-OAHWW4H7.js";
5
5
  import {
6
6
  logError
7
- } from "../chunk-CXM7PELK.js";
7
+ } from "../chunk-HIBLRYTW.js";
8
8
 
9
9
  // src/bin/suipay.ts
10
10
  main().catch((err) => {
@@ -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",
@@ -4924,6 +4924,19 @@ var SERVICE_CODES = {
4924
4924
  user: null,
4925
4925
  logOnly: true
4926
4926
  },
4927
+ // A readiness gauge moved while the process is still serving. Not a degraded
4928
+ // boot: `service.config_degraded` is reserved for that, and for the sample
4929
+ // that actually fails closed.
4930
+ "service.readiness": {
4931
+ surfaces: ["gateway"],
4932
+ status: null,
4933
+ title: "Readiness gauge updated",
4934
+ paymentState: "not_charged",
4935
+ retry: "never",
4936
+ nextAction: "none",
4937
+ user: null,
4938
+ logOnly: true
4939
+ },
4927
4940
  // A best-effort write (a trace event, a receipt, a delivery record) failed.
4928
4941
  // The request it belongs to keeps its answer.
4929
4942
  "service.bookkeeping_failed": {
@@ -4935,6 +4948,39 @@ var SERVICE_CODES = {
4935
4948
  nextAction: "none",
4936
4949
  user: null,
4937
4950
  logOnly: true
4951
+ },
4952
+ // What a process started with: network, posture, rails, gas pool. Healthy.
4953
+ "service.boot": {
4954
+ surfaces: ["gateway", "seller", "indexer"],
4955
+ status: null,
4956
+ title: "Service started",
4957
+ paymentState: "not_charged",
4958
+ retry: "never",
4959
+ nextAction: "none",
4960
+ user: null,
4961
+ logOnly: true
4962
+ },
4963
+ // A background worker started, stopped, swept or retried on schedule. Healthy.
4964
+ "service.lifecycle": {
4965
+ surfaces: ["gateway", "seller", "indexer"],
4966
+ status: null,
4967
+ title: "Background work progressed",
4968
+ paymentState: "not_charged",
4969
+ retry: "never",
4970
+ nextAction: "none",
4971
+ user: null,
4972
+ logOnly: true
4973
+ },
4974
+ // Detail about healthy traffic an operator may want when reading a trace.
4975
+ "service.diagnostic": {
4976
+ surfaces: ["gateway", "seller", "indexer"],
4977
+ status: null,
4978
+ title: "Diagnostic detail",
4979
+ paymentState: "not_charged",
4980
+ retry: "never",
4981
+ nextAction: "none",
4982
+ user: null,
4983
+ logOnly: true
4938
4984
  }
4939
4985
  };
4940
4986
 
@@ -5635,6 +5681,233 @@ function newTraceId(randomBytes3 = cryptoRandomBytes) {
5635
5681
  return /^0+$/.test(hex) ? newTraceId(randomBytes3) : hex;
5636
5682
  }
5637
5683
 
5684
+ // ../core/dist/errors/context-allowlist.js
5685
+ var CONTEXT_ALLOWLIST = /* @__PURE__ */ new Set([
5686
+ // Settlement and request identifiers.
5687
+ "txDigest",
5688
+ "digest",
5689
+ "challengeId",
5690
+ "paymentId",
5691
+ "paymentHash",
5692
+ "paymentKey",
5693
+ "paymentState",
5694
+ "requestId",
5695
+ "traceId",
5696
+ "clientId",
5697
+ "serviceId",
5698
+ "configId",
5699
+ "seedId",
5700
+ "grantId",
5701
+ "grantObjectId",
5702
+ "sameGrantObjectId",
5703
+ "verifiedGrant",
5704
+ "poolObjectId",
5705
+ "packageId",
5706
+ "activePackageId",
5707
+ "expectedPackageId",
5708
+ "actualPackageId",
5709
+ "mandateId",
5710
+ "session",
5711
+ "coinId",
5712
+ "coinIds",
5713
+ "id",
5714
+ "dedupeKey",
5715
+ "hook",
5716
+ // Addresses (public on chain).
5717
+ "owner",
5718
+ "payTo",
5719
+ "recipient",
5720
+ "delegateAddress",
5721
+ // Codes, kinds and states.
5722
+ "code",
5723
+ "innerCode",
5724
+ "requestedCode",
5725
+ "failureCode",
5726
+ "oauthError",
5727
+ "errorKind",
5728
+ "kind",
5729
+ "mode",
5730
+ "effectiveMode",
5731
+ "state",
5732
+ "outcome",
5733
+ "status",
5734
+ "httpStatus",
5735
+ "reason",
5736
+ "action",
5737
+ "stage",
5738
+ "paid",
5739
+ "delivery",
5740
+ "sellerStatus",
5741
+ "sellerCode",
5742
+ "bindingCode",
5743
+ "errorName",
5744
+ "gasStationStatus",
5745
+ "readFailure",
5746
+ "refusal",
5747
+ "refusedAs",
5748
+ "registryCode",
5749
+ "sessionDecision",
5750
+ "settleCode",
5751
+ "signedRequest",
5752
+ "signerCode",
5753
+ "consentCode",
5754
+ "publicReason",
5755
+ "details",
5756
+ "event",
5757
+ "eventType",
5758
+ "surface",
5759
+ "scope",
5760
+ "field",
5761
+ "header",
5762
+ "dependency",
5763
+ "network",
5764
+ "rails",
5765
+ "shard",
5766
+ "metric",
5767
+ "alarm",
5768
+ "alert",
5769
+ "from",
5770
+ "to",
5771
+ "expected",
5772
+ "required",
5773
+ "violated",
5774
+ "diverged",
5775
+ "replaced",
5776
+ "suppressed",
5777
+ "unknown",
5778
+ "verified",
5779
+ "verification",
5780
+ "simulation",
5781
+ "isNew",
5782
+ "needsTopup",
5783
+ "operatorCapSet",
5784
+ "wantAgent",
5785
+ "wantGrant",
5786
+ "wantPool",
5787
+ "limitedBy",
5788
+ "peer",
5789
+ // Counts, amounts and timings.
5790
+ "amount",
5791
+ "scanned",
5792
+ "deleted",
5793
+ "intents",
5794
+ "policies",
5795
+ "connections",
5796
+ "events",
5797
+ "maxQueueSize",
5798
+ "bytes",
5799
+ "sha256",
5800
+ "ts",
5801
+ "count",
5802
+ "countRaw",
5803
+ "matchingCount",
5804
+ "registry_field_count",
5805
+ "applied",
5806
+ "attempt",
5807
+ "attempts",
5808
+ "cap",
5809
+ "max",
5810
+ "maxChallenges",
5811
+ "MAX_GAS_COIN_PAGES",
5812
+ "pagesScanned",
5813
+ "size",
5814
+ "free",
5815
+ "used",
5816
+ "fill",
5817
+ "limits",
5818
+ "refills",
5819
+ "refilled",
5820
+ "split",
5821
+ "unconfirmed",
5822
+ "spent",
5823
+ "reserveAfter",
5824
+ "claimedUntilMs",
5825
+ "repaired",
5826
+ "splits",
5827
+ "spend",
5828
+ "reserve",
5829
+ "reserveBalance",
5830
+ "ownerDailyMist",
5831
+ "ownerHourlyMist",
5832
+ "ownerIdentityDailyMist",
5833
+ "delegateDailyMist",
5834
+ "delegateHourlyMist",
5835
+ "delegateIdentityDailyMist",
5836
+ "consecutiveFailures",
5837
+ "failuresInARow",
5838
+ "epochReadFailures",
5839
+ "daysRemaining",
5840
+ "deadline",
5841
+ "delay",
5842
+ "delayMs",
5843
+ "ageMs",
5844
+ "timeoutMs",
5845
+ "nowMs",
5846
+ "switchedAtMs",
5847
+ "observeUntil",
5848
+ "window",
5849
+ "checkpointSeq",
5850
+ "eventSeq",
5851
+ "sampleSubjects",
5852
+ // Operator-facing error text. Redacted and length-capped like every string.
5853
+ "error",
5854
+ "errors",
5855
+ "err",
5856
+ "lastError",
5857
+ "outcomeError",
5858
+ "detail",
5859
+ "raw",
5860
+ "value"
5861
+ ]);
5862
+ var MAX_CONTEXT_STRING = 512;
5863
+ var MAX_CONTEXT_ARRAY = 32;
5864
+ var MAX_CONTEXT_DEPTH = 4;
5865
+ function filterContext(context) {
5866
+ let dropped = 0;
5867
+ const filterValue = (value2, depth) => {
5868
+ if (typeof value2 === "bigint")
5869
+ return value2.toString();
5870
+ if (value2 === null || typeof value2 !== "object")
5871
+ return value2;
5872
+ if (depth >= MAX_CONTEXT_DEPTH) {
5873
+ dropped += 1;
5874
+ return void 0;
5875
+ }
5876
+ if (Array.isArray(value2)) {
5877
+ return value2.slice(0, MAX_CONTEXT_ARRAY).map((item) => filterValue(item, depth + 1));
5878
+ }
5879
+ if (value2 instanceof Date)
5880
+ return value2.toISOString();
5881
+ return filterObject(value2, depth + 1);
5882
+ };
5883
+ const filterObject = (object, depth) => {
5884
+ const out = {};
5885
+ for (const [key, value2] of Object.entries(object)) {
5886
+ if (!CONTEXT_ALLOWLIST.has(key)) {
5887
+ dropped += 1;
5888
+ continue;
5889
+ }
5890
+ const kept = filterValue(value2, depth);
5891
+ if (kept !== void 0)
5892
+ out[key] = kept;
5893
+ }
5894
+ return out;
5895
+ };
5896
+ const value = filterObject(context, 0);
5897
+ return { value, dropped };
5898
+ }
5899
+ function capContextStrings(value) {
5900
+ if (typeof value === "string") {
5901
+ return value.length > MAX_CONTEXT_STRING ? `${value.slice(0, MAX_CONTEXT_STRING)}\u2026` : value;
5902
+ }
5903
+ if (Array.isArray(value))
5904
+ return value.map(capContextStrings);
5905
+ if (value !== null && typeof value === "object") {
5906
+ return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, capContextStrings(v)]));
5907
+ }
5908
+ return value;
5909
+ }
5910
+
5638
5911
  // ../core/dist/errors/log.js
5639
5912
  var MAX_CAUSE_DEPTH = 5;
5640
5913
  function causeChain(error) {
@@ -5685,6 +5958,7 @@ function safeStringify(value) {
5685
5958
  function errorLogLine(context, error, now = /* @__PURE__ */ new Date()) {
5686
5959
  const wantStack = context.withStack ?? (context.httpStatus !== void 0 && context.httpStatus >= 500);
5687
5960
  const stack = wantStack && error instanceof Error && error.stack ? redactSecrets(error.stack) : void 0;
5961
+ const filtered = context.context ? filterContext(context.context) : void 0;
5688
5962
  return {
5689
5963
  level: context.level ?? "error",
5690
5964
  time: now.toISOString(),
@@ -5696,10 +5970,12 @@ function errorLogLine(context, error, now = /* @__PURE__ */ new Date()) {
5696
5970
  trace_id: context.traceId || newTraceId(),
5697
5971
  cause: error === void 0 ? [] : causeChain(error),
5698
5972
  ...stack ? { stack } : {},
5699
- ...context.context ? { context: redactValue(context.context) } : {}
5973
+ ...filtered ? { context: capContextStrings(redactValue(filtered.value)) } : {},
5974
+ ...filtered && filtered.dropped > 0 ? { context_dropped: filtered.dropped } : {}
5700
5975
  };
5701
5976
  }
5702
5977
  var stderrWriter = (line) => console.error(line);
5978
+ var lineShipper = null;
5703
5979
  function logError(context, error, write = stderrWriter) {
5704
5980
  let line;
5705
5981
  let traceId = "";
@@ -5720,6 +5996,12 @@ function logError(context, error, write = stderrWriter) {
5720
5996
  write(line);
5721
5997
  } catch {
5722
5998
  }
5999
+ if (write === stderrWriter && lineShipper) {
6000
+ try {
6001
+ lineShipper.enqueue(line, context.level ?? "error");
6002
+ } catch {
6003
+ }
6004
+ }
5723
6005
  }
5724
6006
 
5725
6007
  // ../core/dist/errors/suipay-error.js
@@ -5,7 +5,7 @@ import {
5
5
  loadMcpConfig,
6
6
  loadPaymentProfile,
7
7
  logError
8
- } from "./chunk-CXM7PELK.js";
8
+ } from "./chunk-HIBLRYTW.js";
9
9
 
10
10
  // src/index.ts
11
11
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.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";
@@ -1267,6 +1267,16 @@ declare const ERRORS: {
1267
1267
  readonly user: null;
1268
1268
  readonly logOnly: true;
1269
1269
  };
1270
+ readonly 'service.readiness': {
1271
+ readonly surfaces: readonly ["gateway"];
1272
+ readonly status: null;
1273
+ readonly title: "Readiness gauge updated";
1274
+ readonly paymentState: "not_charged";
1275
+ readonly retry: "never";
1276
+ readonly nextAction: "none";
1277
+ readonly user: null;
1278
+ readonly logOnly: true;
1279
+ };
1270
1280
  readonly 'service.bookkeeping_failed': {
1271
1281
  readonly surfaces: readonly ["gateway"];
1272
1282
  readonly status: null;
@@ -1277,6 +1287,36 @@ declare const ERRORS: {
1277
1287
  readonly user: null;
1278
1288
  readonly logOnly: true;
1279
1289
  };
1290
+ readonly 'service.boot': {
1291
+ readonly surfaces: readonly ["gateway", "seller", "indexer"];
1292
+ readonly status: null;
1293
+ readonly title: "Service started";
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.lifecycle': {
1301
+ readonly surfaces: readonly ["gateway", "seller", "indexer"];
1302
+ readonly status: null;
1303
+ readonly title: "Background work progressed";
1304
+ readonly paymentState: "not_charged";
1305
+ readonly retry: "never";
1306
+ readonly nextAction: "none";
1307
+ readonly user: null;
1308
+ readonly logOnly: true;
1309
+ };
1310
+ readonly 'service.diagnostic': {
1311
+ readonly surfaces: readonly ["gateway", "seller", "indexer"];
1312
+ readonly status: null;
1313
+ readonly title: "Diagnostic detail";
1314
+ readonly paymentState: "not_charged";
1315
+ readonly retry: "never";
1316
+ readonly nextAction: "none";
1317
+ readonly user: null;
1318
+ readonly logOnly: true;
1319
+ };
1280
1320
  readonly 'limit.concurrency_exceeded': {
1281
1321
  readonly surfaces: readonly ["gateway"];
1282
1322
  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-BUaEV9I3.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-HIBLRYTW.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-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
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-OAHWW4H7.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-HIBLRYTW.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.2",
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": {