shinjuku-shield 0.3.143 → 0.3.144

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
@@ -6,19 +6,19 @@ answers privately, in a terminal chat or for your agent app. Its `mcp`
6
6
  command runs a local MCP server (stdio) for your agent. Your keys never
7
7
  leave your machine.
8
8
 
9
- This is version 0.3.143. The npm packages `shinjuku-shield` and
9
+ This is version 0.3.144. The npm packages `shinjuku-shield` and
10
10
  `shinjuku-shielded` hold the same files. The command is `shinjuku`.
11
11
 
12
12
  ## Set up
13
13
 
14
14
  ```sh
15
- npm install -g shinjuku@0.3.143
15
+ npm install -g shinjuku@0.3.144
16
16
  shinjuku setup
17
17
  ```
18
18
 
19
19
  Type the two lines as they are. `npx install shinjuku` does not work: npx
20
20
  reads `install` as the name of another npm package. To set up without
21
- installing, type `npx shinjuku@0.3.143 setup`.
21
+ installing, type `npx shinjuku@0.3.144 setup`.
22
22
 
23
23
  Setup makes the wallet on this machine, a private passphrase file, and the
24
24
  checked proof tools (about 191 MB), and writes `config.json`. It also writes
@@ -36,13 +36,13 @@ Every wallet command works after `shinjuku`, for example `shinjuku balance`,
36
36
  Claude Code:
37
37
 
38
38
  ```sh
39
- claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.143 mcp
39
+ claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.144 mcp
40
40
  ```
41
41
 
42
42
  Claude Desktop (`claude_desktop_config.json`) or Cursor (`~/.cursor/mcp.json`):
43
43
 
44
44
  ```json
45
- { "mcpServers": { "shinjuku": { "command": "npx", "args": ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.143", "mcp"] } } }
45
+ { "mcpServers": { "shinjuku": { "command": "npx", "args": ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.144", "mcp"] } } }
46
46
  ```
47
47
 
48
48
  On native Windows, if the host cannot find `npx`, use `"command": "cmd"` and
@@ -55,7 +55,7 @@ Codex (the Codex app and Codex CLI read the same file, `~/.codex/config.toml`):
55
55
  ```toml
56
56
  [mcp_servers.shinjuku]
57
57
  command = "npx"
58
- args = ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.143", "mcp"]
58
+ args = ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.144", "mcp"]
59
59
  startup_timeout_sec = 120
60
60
  tool_timeout_sec = 300
61
61
  ```
package/manifest.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schema": "carbon-shielded-wallet/bundle-manifest/v1",
3
3
  "file": "shinjuku-wallet.mjs",
4
- "sha256": "d1d7233b86e252e58009678280970cb3aaa264c8569bd29f790e5a592a948138",
5
- "bytes": 8974175,
6
- "sourceCommit": "d25e1296d250570e9a2a5c427ea98730b75a1cee",
4
+ "sha256": "325c7ac76ca281c68aaeb201b8601305495083f9bfb211578189e55f2f9f298c",
5
+ "bytes": 8975329,
6
+ "sourceCommit": "4c820285fc768c8cdfbc6496a62d691a71962a14",
7
7
  "sourceDirty": false,
8
8
  "installRecordMatchesLockfile": true,
9
9
  "releaseRule": "valid only when two fresh npm ci --ignore-scripts builds on different OSes give the same sha256; installRecordMatchesLockfile true means every entry npm installed equals its package-lock.json entry and every entry not marked optional, devOptional included, is installed: an optional entry (a package for another platform) may be absent",
@@ -1038,5 +1038,5 @@
1038
1038
  "version": "1.8.0"
1039
1039
  }
1040
1040
  ],
1041
- "publishedAt": "2026-11-01T09:22:38.910Z"
1041
+ "publishedAt": "2026-11-01T09:50:32.342Z"
1042
1042
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "shinjuku-shield",
3
- "version": "0.3.143",
3
+ "version": "0.3.144",
4
4
  "mcpName": "io.github.ShinjukuStaition/shinjuku-mcp",
5
5
  "description": "Shinjuku Shielded, the private x402 facilitator on Solana: the self-custody wallet CLI and its MCP server. Shield, pay, and unshield USDC from any MCP agent, under caps you set.",
6
- "shinjukuRelease": "d1d7233b",
7
- "shinjukuSha256": "d1d7233b86e252e58009678280970cb3aaa264c8569bd29f790e5a592a948138",
6
+ "shinjukuRelease": "325c7ac7",
7
+ "shinjukuSha256": "325c7ac76ca281c68aaeb201b8601305495083f9bfb211578189e55f2f9f298c",
8
8
  "license": "SEE LICENSE IN LICENSE.txt",
9
9
  "author": "Shinjuku Shielded",
10
10
  "homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
@@ -82261,14 +82261,33 @@ function createAnchorReader({ connection, profile }) {
82261
82261
  const ringSlotServes = !current && requireCapacity && state.anchorMode === 2 && state.anchorRing !== null && newest !== void 0 && newest.anchorIndex === BigInt(state.currentIndex) && p03RingAnchorHasQuoteMargin(BigInt(newest.epoch), chainTimestamp);
82262
82262
  if (requireCapacity && !current && !ringSlotServes) fail17("anchor_not_ready");
82263
82263
  const selected = current ?? newest;
82264
- return {
82264
+ const read = {
82265
82265
  ...selected,
82266
82266
  chainTimestamp,
82267
82267
  finalizedSlot: slot3,
82268
82268
  retainedAnchors: anchors.filter((a) => a !== selected)
82269
82269
  };
82270
+ if (state.anchorMode === 2 && state.anchorRing !== null) ringModeReads.add(read);
82271
+ return read;
82270
82272
  };
82271
82273
  }
82274
+ function ringSlotServesPayment(read, quoteAnchor) {
82275
+ return quoteAnchor !== void 0 && ringModeReads.has(read) && p03RingAnchorServesQuote(quoteAnchor, {
82276
+ chainTimestamp: read.chainTimestamp,
82277
+ finalizedSlot: read.finalizedSlot,
82278
+ anchors: [read, ...read.retainedAnchors].map((a) => ({ epoch: BigInt(a.epoch), anchorIndex: BigInt(a.anchorIndex), anchorRoot: BigInt(a.anchorRoot) }))
82279
+ });
82280
+ }
82281
+ function quoteAnchorOfOffer(offer) {
82282
+ try {
82283
+ const extra = JSON.parse(offer.outboundJson).paymentRequirements.extra;
82284
+ const field4 = (value2) => typeof value2 === "string" && /^(0|[1-9][0-9]*)$/.test(value2) ? BigInt(value2) : void 0;
82285
+ const anchor = { epoch: field4(extra.epoch), anchorIndex: field4(extra.anchorIndex), anchorRoot: field4(extra.anchorRoot) };
82286
+ return Object.values(anchor).includes(void 0) ? void 0 : anchor;
82287
+ } catch {
82288
+ return void 0;
82289
+ }
82290
+ }
82272
82291
  function reusableBeforeSettle(offer, chain, elapsedMs) {
82273
82292
  if (!chain || !Number.isFinite(elapsedMs) || elapsedMs < 0 || elapsedMs > PRE_SETTLE_REUSE_MAX_AGE_MS) return false;
82274
82293
  const expiresAt = JSON.parse(offer.outboundJson).sellerAcceptance?.expiresAt;
@@ -82413,14 +82432,14 @@ async function createSellerAdapter({
82413
82432
  anchorPoll = void 0;
82414
82433
  });
82415
82434
  };
82416
- const readCurrentAnchor = async (first) => {
82417
- const isCurrent = (chain2) => chain2.epoch === chain2.chainTimestamp / 300n;
82435
+ const readCurrentAnchor = async (first, quoteAnchor) => {
82436
+ const usable = (chain2) => chain2.epoch === chain2.chainTimestamp / 300n || ringSlotServesPayment(chain2, quoteAnchor);
82418
82437
  const chain = first ?? await readAnchor();
82419
- if (isCurrent(chain)) return chain;
82438
+ if (usable(chain)) return chain;
82420
82439
  await requestFacilitatorAnchor();
82421
82440
  for (let attempt = 1; ; attempt += 1) {
82422
82441
  const next = await readAnchor();
82423
- if (isCurrent(next)) return next;
82442
+ if (usable(next)) return next;
82424
82443
  if (attempt >= ANCHOR_POLL_ATTEMPTS) fail17("anchor_not_ready");
82425
82444
  await sleep4(ANCHOR_POLL_MS);
82426
82445
  }
@@ -82966,7 +82985,7 @@ async function createSellerAdapter({
82966
82985
  }
82967
82986
  const firstIntake = intakeChain !== void 0 && !offer.settleAttempted;
82968
82987
  if (firstIntake) {
82969
- await readCurrentAnchor(intakeChain);
82988
+ await readCurrentAnchor(intakeChain, quoteAnchorOfOffer(offer));
82970
82989
  offer = { ...offer, phase: "settlement_pending", settleAttempted: true };
82971
82990
  await put(nonce, offer);
82972
82991
  mark("first-intake-settle");
@@ -82985,7 +83004,7 @@ async function createSellerAdapter({
82985
83004
  const renewed = await renewPreSettlementAcceptance(nonce, offer, chain);
82986
83005
  if (!renewed) return { status: 202, code: PAYMENT_REFUSED };
82987
83006
  offer = renewed;
82988
- await readCurrentAnchor(chain);
83007
+ await readCurrentAnchor(chain, quoteAnchorOfOffer(offer));
82989
83008
  const verified = await facilitator("verify", offer.outboundJson);
82990
83009
  mark("verify");
82991
83010
  if (verified?.isValid !== true) {
@@ -83174,7 +83193,7 @@ async function createSellerAdapter({
83174
83193
  };
83175
83194
  return { server, handle, close, signerPublicKey, settledTransactions, offerSummaries, discardUnsentOffer };
83176
83195
  }
83177
- var import_web3113, LOOPBACK_ORIGIN, BINDING, SCHEMA2, OFFERS_LAYOUT, SNAPSHOT_EVERY_MS, LOADER2, canonical4, storeProfileIdentity, jsonSafe, bigint, encodeHeader, PROGRAM_DATA_HEADER_BYTES, hashedProgramDataHeaders, PAYMENT_REFUSED, FACILITATOR_UNDERFUNDED, DEFINITE_VERIFY_REFUSALS, definiteVerifyRefusal, refusedBeforeSettlement, ANCHOR_REQUEST_TIMEOUT_MS2, ANCHOR_POLL_ATTEMPTS, ANCHOR_POLL_MS, ANCHOR_BUSY_DEFAULT_SECONDS, ANCHOR_BUSY_MAX_SECONDS, MEMO_PRECOMPUTES_MAX, MEMO_PRECOMPUTE_WAIT_MS, WALLET_MERCHANT_SLOT, PRE_SETTLE_REUSE_MARGIN_S, PRE_SETTLE_REUSE_MAX_AGE_MS, FINALIZED_MEMO_MAX_AGE_MS, INTAKE_REUSE_MAX_AGE_MS, pause, FOLLOW_UP_DELAYS_MS, FOLLOW_UP_RESETTLE_FROM, UPSTREAM_FAILED, UPSTREAM_BODY_MAX, upstreamFailure, forwardedContentType, CONFIRMED_TRANSACTION_READ;
83196
+ var import_web3113, LOOPBACK_ORIGIN, BINDING, SCHEMA2, OFFERS_LAYOUT, SNAPSHOT_EVERY_MS, LOADER2, canonical4, storeProfileIdentity, jsonSafe, bigint, encodeHeader, PROGRAM_DATA_HEADER_BYTES, hashedProgramDataHeaders, ringModeReads, PAYMENT_REFUSED, FACILITATOR_UNDERFUNDED, DEFINITE_VERIFY_REFUSALS, definiteVerifyRefusal, refusedBeforeSettlement, ANCHOR_REQUEST_TIMEOUT_MS2, ANCHOR_POLL_ATTEMPTS, ANCHOR_POLL_MS, ANCHOR_BUSY_DEFAULT_SECONDS, ANCHOR_BUSY_MAX_SECONDS, MEMO_PRECOMPUTES_MAX, MEMO_PRECOMPUTE_WAIT_MS, WALLET_MERCHANT_SLOT, PRE_SETTLE_REUSE_MARGIN_S, PRE_SETTLE_REUSE_MAX_AGE_MS, FINALIZED_MEMO_MAX_AGE_MS, INTAKE_REUSE_MAX_AGE_MS, pause, FOLLOW_UP_DELAYS_MS, FOLLOW_UP_RESETTLE_FROM, UPSTREAM_FAILED, UPSTREAM_BODY_MAX, upstreamFailure, forwardedContentType, CONFIRMED_TRANSACTION_READ;
83178
83197
  var init_service = __esm({
83179
83198
  "wallet/src/seller/service.mjs"() {
83180
83199
  "use strict";
@@ -83211,6 +83230,7 @@ var init_service = __esm({
83211
83230
  encodeHeader = (v) => Buffer.from(JSON.stringify(v)).toString("base64");
83212
83231
  PROGRAM_DATA_HEADER_BYTES = 45;
83213
83232
  hashedProgramDataHeaders = /* @__PURE__ */ new Map();
83233
+ ringModeReads = /* @__PURE__ */ new WeakSet();
83214
83234
  PAYMENT_REFUSED = "payment_refused_pay_again";
83215
83235
  FACILITATOR_UNDERFUNDED = "facilitator_underfunded";
83216
83236
  DEFINITE_VERIFY_REFUSALS = /* @__PURE__ */ new Set([