shinjuku-shield 0.3.230 → 0.3.232

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
@@ -8,7 +8,7 @@ web services and AI answers from your private balance, so the payment does
8
8
  not show who paid. It works inside your AI app (Claude, Cursor, Codex) and in
9
9
  a terminal. Only you hold the keys: they never leave your computer.
10
10
 
11
- This is version 0.3.230. The command is `shinjuku`.
11
+ This is version 0.3.232. The command is `shinjuku`.
12
12
 
13
13
  ## Set up
14
14
 
@@ -55,7 +55,7 @@ choose Reconnect.
55
55
 
56
56
  ## Add money
57
57
 
58
- Ask your AI app: "Add 0.50 USDC to my private balance." It gives you a
58
+ Ask your AI app: "Give me an address to add 0.50 USDC to my wallet." It gives you a
59
59
  one-time address. Send USDC on Solana to it from any wallet or exchange. Any
60
60
  amount from 0.01 USDC works, and you need no SOL. The USDC becomes private by
61
61
  itself.
@@ -112,7 +112,7 @@ Add it yourself. The name of the wallet in your app is `shinjuku`.
112
112
  Claude Code:
113
113
 
114
114
  ```sh
115
- claude mcp add --scope user shinjuku -- npx -y --prefer-offline --no-audit --no-fund shinjuku-shield@0.3.230 mcp
115
+ claude mcp add --scope user shinjuku -- npx -y --prefer-offline --no-audit --no-fund shinjuku-shield@0.3.232 mcp
116
116
  ```
117
117
 
118
118
  `--prefer-offline` runs the copy of the wallet that npm saved. If npm has not saved it yet, that start asks
@@ -131,7 +131,7 @@ with the Releases table in
131
131
  Versions are published from GitHub Actions with npm provenance.
132
132
 
133
133
  `shinjuku-shield` is the package that holds the wallet. `shinjuku-shielded`
134
- 0.3.230, its older name, runs this package at the same version, so wallets
134
+ 0.3.232, its older name, runs this package at the same version, so wallets
135
135
  installed under that name keep updating. New installs use `shinjuku`.
136
136
 
137
137
  The full guide is
package/manifest.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "schema": "carbon-shielded-wallet/bundle-manifest/v1",
3
3
  "file": "shinjuku-wallet.mjs",
4
- "sha256": "2fc5d76655c3647dc53aa68ae46db4a45cc69964f6f514a089e0ce253e7f70bc",
5
- "bytes": 10371626,
6
- "sourceCommit": "c0704a702c21b172d0103f473ee317d42c847048",
4
+ "sha256": "2f7cb80719d593daf7009d1fd201163bf0e178bf71da9f2982f540cb88bef93c",
5
+ "bytes": 10397692,
6
+ "sourceCommit": "3e583881833a8dca4001cfedfbf18a779a0c16b5",
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",
10
10
  "lockfiles": [
11
11
  {
12
12
  "path": "package-lock.json",
13
- "sha256": "fb09574c17591c046d1af40aff530699dd7b268182fb12978da32f564dea1ad6"
13
+ "sha256": "3f46c881ebcd4a6da512e689ea562005ae43b8376251aa68d3ef7b937fec66ea"
14
14
  }
15
15
  ],
16
16
  "esbuildVersion": "0.28.1",
@@ -82,8 +82,8 @@
82
82
  },
83
83
  {
84
84
  "path": "wallet/src/mcp/views/price-card.html",
85
- "sha256": "15f2b89b5734a50ad8f7c6df47cf126adf620c1d0b8bb67ac7a527b97b26d054",
86
- "bytes": 6417
85
+ "sha256": "790a908cf656ad8240721d0263a783615297f5d4af98d3d0bf1d40555b74ecc3",
86
+ "bytes": 7464
87
87
  },
88
88
  {
89
89
  "path": "wallet/src/mcp/views/receipts.html",
@@ -92,8 +92,8 @@
92
92
  },
93
93
  {
94
94
  "path": "wallet/src/mcp/views/shared.js",
95
- "sha256": "490941e561a44e115b60d6c38e0d5ecbcae909b59b66106022643908c9e4cda5",
96
- "bytes": 3427
95
+ "sha256": "b4db09678412f922ef07c22bb85d402ddfe90aab7c3a93b9a0ef3395c195b403",
96
+ "bytes": 3546
97
97
  },
98
98
  {
99
99
  "path": "wallet/src/mcp/views/wallet-card.html",
@@ -1075,8 +1075,8 @@
1075
1075
  ],
1076
1076
  "seller": {
1077
1077
  "file": "shinjuku-seller.mjs",
1078
- "sha256": "10b55d5356a04206c53b602d2c4d5157881619a1121dff4b7700b5b4fa31ffe9",
1079
- "bytes": 4194469,
1078
+ "sha256": "623b3c6834564b5bf95987f1496c4b63b3a07ac615c36bb95fd55ded5cc701cf",
1079
+ "bytes": 4199870,
1080
1080
  "entry": "wallet/src/seller/exact/index.mjs",
1081
1081
  "external": [
1082
1082
  "@x402/core/http",
@@ -1968,5 +1968,5 @@
1968
1968
  }
1969
1969
  ]
1970
1970
  },
1971
- "publishedAt": "2026-11-13T11:54:24.076Z"
1971
+ "publishedAt": "2026-11-16T19:43:49.036Z"
1972
1972
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "shinjuku-shield",
3
- "version": "0.3.230",
3
+ "version": "0.3.232",
4
4
  "mcpName": "io.github.ShinjukuStaition/shinjuku-shield",
5
5
  "description": "Shinjuku Shield, private x402 payments 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": "2fc5d766",
7
- "shinjukuSha256": "2fc5d76655c3647dc53aa68ae46db4a45cc69964f6f514a089e0ce253e7f70bc",
6
+ "shinjukuRelease": "2f7cb807",
7
+ "shinjukuSha256": "2f7cb80719d593daf7009d1fd201163bf0e178bf71da9f2982f540cb88bef93c",
8
8
  "license": "SEE LICENSE IN LICENSE.txt",
9
9
  "author": "Shinjuku Shield",
10
10
  "homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
@@ -80028,14 +80028,20 @@ AUTHCHALLENGE SAFECOOKIE ${clientNonce.toString("hex")}\r
80028
80028
  socket.on("close", () => {
80029
80029
  streaming = false;
80030
80030
  });
80031
- resolvePromise({ close: () => {
80032
- streaming = false;
80033
- try {
80034
- socket.end("QUIT\r\n");
80035
- } catch {
80031
+ resolvePromise({
80032
+ close: () => {
80033
+ streaming = false;
80034
+ try {
80035
+ socket.end("QUIT\r\n");
80036
+ } catch {
80037
+ }
80038
+ socket.destroy();
80039
+ },
80040
+ send: (command) => {
80041
+ if (streaming && !socket.destroyed) socket.write(`${command}\r
80042
+ `);
80036
80043
  }
80037
- socket.destroy();
80038
- } });
80044
+ });
80039
80045
  if (text2) socket.emit("data", Buffer.alloc(0));
80040
80046
  return void 0;
80041
80047
  }
@@ -80862,6 +80868,149 @@ function startTorTimingMarks() {
80862
80868
  });
80863
80869
  }
80864
80870
  startTorTimingMarks();
80871
+ var STALL_CLOSE_MS = 1e4;
80872
+ var STALL_CLOSE_CAP = 2;
80873
+ var STALL_CLOSE_LOG = "stall-closes.log";
80874
+ var STALL_LOG_TAIL = 65536;
80875
+ var STALL_WAITING = /* @__PURE__ */ new Set(["NEW", "DETACHED"]);
80876
+ function loggedStallCloses(home, torStart2) {
80877
+ const perOnion = /* @__PURE__ */ new Map();
80878
+ const streams = /* @__PURE__ */ new Set();
80879
+ const path = join24(managedTorDir(home), STALL_CLOSE_LOG);
80880
+ let present = true;
80881
+ try {
80882
+ lstatSync(path);
80883
+ } catch (error) {
80884
+ present = error?.code !== "ENOENT";
80885
+ }
80886
+ let text2 = "";
80887
+ if (present) {
80888
+ text2 = readHomeFileTail(home, path, STALL_LOG_TAIL);
80889
+ if (typeof text2 !== "string") return void 0;
80890
+ }
80891
+ for (const line of text2.split("\n")) {
80892
+ const one = / tor (\S+) close \d+ onion ([a-z2-7]{8}) stream (\d{1,20}) /.exec(line);
80893
+ if (!one || one[1] !== torStart2) continue;
80894
+ if (!perOnion.has(one[2])) perOnion.set(one[2], /* @__PURE__ */ new Set());
80895
+ perOnion.get(one[2]).add(one[3]);
80896
+ streams.add(one[3]);
80897
+ }
80898
+ return { byOnion: new Map([...perOnion].map(([prefix, ids]) => [prefix, ids.size])), streams };
80899
+ }
80900
+ function startStallCloser() {
80901
+ const run2 = String(process.env.SHINJUKU_WALLET_PROXIED ?? "");
80902
+ if (!run2.startsWith("tor ")) return;
80903
+ setImmediate(async () => {
80904
+ try {
80905
+ const home = setupHome(process.env);
80906
+ const state2 = managedTorState(home);
80907
+ let tunnel;
80908
+ try {
80909
+ tunnel = new URL(run2.split(" ")[1]);
80910
+ } catch {
80911
+ return;
80912
+ }
80913
+ if (!state2 || tunnel.hostname !== "127.0.0.1" || state2.port !== Number(tunnel.port)) return;
80914
+ const torStart2 = `${state2.pid}:${state2.startedAt ?? "?"}`;
80915
+ const ours = ownOnionPrefixes();
80916
+ const streams = /* @__PURE__ */ new Map();
80917
+ const ended2 = /* @__PURE__ */ new Set();
80918
+ const got = /* @__PURE__ */ new Set();
80919
+ const matched = /* @__PURE__ */ new Set();
80920
+ const timers = [];
80921
+ let seq3 = 0;
80922
+ let lastRequested = 0;
80923
+ let previousNew;
80924
+ let stopped = false;
80925
+ let session;
80926
+ const close = (address2, hsdir, id) => {
80927
+ const prefix = ours.get(address2);
80928
+ const open3 = () => !stopped && session && prefix && !got.has(address2) && !ended2.has(`${address2} ${hsdir}`);
80929
+ const stream = streams.get(id);
80930
+ if (!open3() || !stream || !STALL_WAITING.has(stream.status)) return;
80931
+ const stamp = stream.stamp;
80932
+ const done = loggedStallCloses(home, torStart2);
80933
+ if (!done || (done.byOnion.get(prefix) ?? 0) >= STALL_CLOSE_CAP || done.streams.has(id)) return;
80934
+ const number2 = (done.byOnion.get(prefix) ?? 0) + 1;
80935
+ setImmediate(() => {
80936
+ try {
80937
+ const now = streams.get(id);
80938
+ if (!open3() || now !== stream || now.stamp !== stamp || !STALL_WAITING.has(now.status)) return;
80939
+ session.send(`CLOSESTREAM ${id} 1`);
80940
+ try {
80941
+ appendFileSync(
80942
+ join24(managedTorDir(home), STALL_CLOSE_LOG),
80943
+ `${(/* @__PURE__ */ new Date()).toISOString()} tor ${torStart2} close ${number2} onion ${prefix} stream ${id} ${now.status.toLowerCase()}
80944
+ `
80945
+ );
80946
+ } catch {
80947
+ stopped = true;
80948
+ }
80949
+ } catch {
80950
+ }
80951
+ });
80952
+ };
80953
+ session = await controlCheck(home, state2, { unref: true, events: (line) => {
80954
+ seq3 += 1;
80955
+ const before = previousNew;
80956
+ previousNew = void 0;
80957
+ const w = line.split(" ");
80958
+ if (w[1] === "STREAM" && /^\d{1,20}$/.test(w[2] ?? "")) {
80959
+ if (w[3] === "NEW" && w.includes("PURPOSE=DIR_FETCH")) {
80960
+ streams.set(w[2], { seq: seq3, stamp: seq3, status: "NEW" });
80961
+ previousNew = w[2];
80962
+ return;
80963
+ }
80964
+ const known = streams.get(w[2]);
80965
+ if (known) {
80966
+ known.status = w[3];
80967
+ known.stamp = seq3;
80968
+ if (w[3] === "CLOSED" || w[3] === "FAILED") streams.delete(w[2]);
80969
+ }
80970
+ return;
80971
+ }
80972
+ if (w[1] !== "HS_DESC") return;
80973
+ const since = lastRequested;
80974
+ if (w[2] === "REQUESTED") lastRequested = seq3;
80975
+ if (!ours.has(w[3])) return;
80976
+ const hsdir = /^\$([0-9A-F]{40})/.exec(w[5] ?? "")?.[1];
80977
+ if (!hsdir) return;
80978
+ if (w[2] === "RECEIVED") {
80979
+ got.add(w[3]);
80980
+ ended2.add(`${w[3]} ${hsdir}`);
80981
+ return;
80982
+ }
80983
+ if (w[2] === "FAILED") {
80984
+ ended2.add(`${w[3]} ${hsdir}`);
80985
+ return;
80986
+ }
80987
+ if (w[2] !== "REQUESTED") return;
80988
+ if (!before || matched.has(before)) return;
80989
+ const waiting = [...streams].filter(([id, s2]) => s2.seq > since && !matched.has(id) && STALL_WAITING.has(s2.status));
80990
+ if (waiting.length !== 1 || waiting[0][0] !== before) return;
80991
+ matched.add(before);
80992
+ const timer = setTimeout(() => {
80993
+ try {
80994
+ close(w[3], hsdir, before);
80995
+ } catch {
80996
+ }
80997
+ }, STALL_CLOSE_MS);
80998
+ timer.unref?.();
80999
+ timers.push(timer);
81000
+ } });
81001
+ if (!session) return;
81002
+ process.once("exit", () => {
81003
+ for (const timer of timers) clearTimeout(timer);
81004
+ try {
81005
+ session.close();
81006
+ } catch {
81007
+ }
81008
+ });
81009
+ } catch {
81010
+ }
81011
+ });
81012
+ }
81013
+ startStallCloser();
80865
81014
 
80866
81015
  // wallet/src/seller/setup.mjs
80867
81016
  init_tunnelGuard();