shinjuku-shield 0.3.233 → 0.3.234

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.233. The command is `shinjuku`.
11
+ This is version 0.3.234. The command is `shinjuku`.
12
12
 
13
13
  ## Set up
14
14
 
@@ -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.233 mcp
115
+ claude mcp add --scope user shinjuku -- npx -y --prefer-offline --no-audit --no-fund shinjuku-shield@0.3.234 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.233, its older name, runs this package at the same version, so wallets
134
+ 0.3.234, 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,9 +1,9 @@
1
1
  {
2
2
  "schema": "carbon-shielded-wallet/bundle-manifest/v1",
3
3
  "file": "shinjuku-wallet.mjs",
4
- "sha256": "f57e91f4ac8dd91b7c88bf7d1f12b403aeced0b1af85461b7c72baebda923fee",
5
- "bytes": 10431768,
6
- "sourceCommit": "d8bf1218551a81a4107dc4e1deb55d976dab9dbf",
4
+ "sha256": "a58340f4851a631086255680831eba498530769d1468b0add3478959b264ec15",
5
+ "bytes": 10510312,
6
+ "sourceCommit": "b0aa438771a15fa66313864cd06a94195f4c30c1",
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",
@@ -77,13 +77,13 @@
77
77
  },
78
78
  {
79
79
  "path": "wallet/src/mcp/views/add-funds.html",
80
- "sha256": "66c439666187d51f69300af63188a9cf48c54fe3390bcf1897e3d15e90162b2c",
81
- "bytes": 5132
80
+ "sha256": "411e3eedd8f2ba828c0451d1a3d4ac0ca33c9ed8fa36a625dc5d99df4fd68203",
81
+ "bytes": 7097
82
82
  },
83
83
  {
84
84
  "path": "wallet/src/mcp/views/price-card.html",
85
- "sha256": "790a908cf656ad8240721d0263a783615297f5d4af98d3d0bf1d40555b74ecc3",
86
- "bytes": 7464
85
+ "sha256": "6ddd9d6c9309ccd028f0549c0d7de1d290cbd8ad1eecf45ac5126550779b0a72",
86
+ "bytes": 7866
87
87
  },
88
88
  {
89
89
  "path": "wallet/src/mcp/views/receipts.html",
@@ -92,13 +92,13 @@
92
92
  },
93
93
  {
94
94
  "path": "wallet/src/mcp/views/shared.js",
95
- "sha256": "b4db09678412f922ef07c22bb85d402ddfe90aab7c3a93b9a0ef3395c195b403",
96
- "bytes": 3546
95
+ "sha256": "a860d8c3487f2a2ec1a39eba720c79fe12e82c48faf82fb1a0e3e8546e3e2a5a",
96
+ "bytes": 7368
97
97
  },
98
98
  {
99
99
  "path": "wallet/src/mcp/views/wallet-card.html",
100
- "sha256": "d218c12e59148f93ec31d3b143a19725169486207b47e4f661996630ea32ae0a",
101
- "bytes": 3583
100
+ "sha256": "e4a20a52f5d8c96e2e7ab5624e9878b643fe2ba32f6dcf3dc61f70e12fc01717",
101
+ "bytes": 5522
102
102
  },
103
103
  {
104
104
  "path": "wallet/vendor/ext-apps-1.7.5/app-with-deps.js",
@@ -1075,8 +1075,8 @@
1075
1075
  ],
1076
1076
  "seller": {
1077
1077
  "file": "shinjuku-seller.mjs",
1078
- "sha256": "abede46f010801e65f2465cb5787c1bfb8eaa74a1039e0b6024ce8aa697c4e7b",
1079
- "bytes": 4201219,
1078
+ "sha256": "3e3e3c578db21d80ffc28ab978364f001964a72b70dfd249082b510bd5298c91",
1079
+ "bytes": 4203882,
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-17T02:22:20.609Z"
1971
+ "publishedAt": "2026-11-17T08:21:23.545Z"
1972
1972
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "shinjuku-shield",
3
- "version": "0.3.233",
3
+ "version": "0.3.234",
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": "f57e91f4",
7
- "shinjukuSha256": "f57e91f4ac8dd91b7c88bf7d1f12b403aeced0b1af85461b7c72baebda923fee",
6
+ "shinjukuRelease": "a58340f4",
7
+ "shinjukuSha256": "a58340f4851a631086255680831eba498530769d1468b0add3478959b264ec15",
8
8
  "license": "SEE LICENSE IN LICENSE.txt",
9
9
  "author": "Shinjuku Shield",
10
10
  "homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
@@ -33380,6 +33380,81 @@ var init_globalDispatcher = __esm({
33380
33380
  });
33381
33381
 
33382
33382
  // wallet/src/net/runEnd.mjs
33383
+ function trackRequests(dispatcher) {
33384
+ if (!dispatcher || typeof dispatcher.dispatch !== "function" || tracked.has(dispatcher)) return dispatcher;
33385
+ const state2 = { running: 0, idle: /* @__PURE__ */ new Set() };
33386
+ tracked.set(dispatcher, state2);
33387
+ const dispatch = dispatcher.dispatch;
33388
+ dispatcher.dispatch = function trackedDispatch(options, handler) {
33389
+ state2.running += 1;
33390
+ let open3 = true;
33391
+ const ended2 = () => {
33392
+ if (!open3) return;
33393
+ open3 = false;
33394
+ state2.running -= 1;
33395
+ if (state2.running === 0) for (const onIdle of [...state2.idle]) onIdle();
33396
+ };
33397
+ const observed2 = new Proxy(handler, {
33398
+ get(target, property) {
33399
+ const value2 = Reflect.get(target, property);
33400
+ if (typeof value2 !== "function") return value2;
33401
+ if (!REQUEST_END_CALLS.has(property)) return value2.bind(target);
33402
+ return (...args) => {
33403
+ try {
33404
+ return value2.apply(target, args);
33405
+ } finally {
33406
+ ended2();
33407
+ }
33408
+ };
33409
+ }
33410
+ });
33411
+ try {
33412
+ return dispatch.call(this, options, observed2);
33413
+ } catch (error) {
33414
+ ended2();
33415
+ throw error;
33416
+ }
33417
+ };
33418
+ return dispatcher;
33419
+ }
33420
+ function destroyNow(dispatcher, error) {
33421
+ try {
33422
+ return Promise.resolve(error === void 0 ? dispatcher.destroy() : dispatcher.destroy(error)).then(() => void 0, () => void 0);
33423
+ } catch {
33424
+ return Promise.resolve();
33425
+ }
33426
+ }
33427
+ function closeDispatcher(dispatcher) {
33428
+ if (!dispatcher || typeof dispatcher.destroy !== "function") return Promise.resolve();
33429
+ const known = retiring.get(dispatcher);
33430
+ if (known) return known;
33431
+ const state2 = tracked.get(dispatcher);
33432
+ const done = new Promise((resolveRetired) => {
33433
+ let timer;
33434
+ let over = false;
33435
+ const retire = () => {
33436
+ if (over) return;
33437
+ over = true;
33438
+ clearTimeout(timer);
33439
+ state2?.idle.delete(retire);
33440
+ destroyNow(dispatcher).then(resolveRetired);
33441
+ };
33442
+ timer = setTimeout(retire, CLOSE_WAIT_MS);
33443
+ timer.unref?.();
33444
+ if (state2 === void 0) return;
33445
+ if (state2.running === 0) {
33446
+ retire();
33447
+ return;
33448
+ }
33449
+ state2.idle.add(retire);
33450
+ });
33451
+ retiring.set(dispatcher, done);
33452
+ return done;
33453
+ }
33454
+ function destroyDispatcher(dispatcher, error) {
33455
+ if (!dispatcher || typeof dispatcher.destroy !== "function") return Promise.resolve();
33456
+ return destroyNow(dispatcher, error);
33457
+ }
33383
33458
  function runSleep(ms) {
33384
33459
  if (ended) return Promise.resolve();
33385
33460
  return new Promise((resolve18) => {
@@ -33397,13 +33472,17 @@ function registerRunDispatchers(list) {
33397
33472
  function registerRunSockets(list) {
33398
33473
  socketSources.add(list);
33399
33474
  }
33400
- var ended, sources, runEnded, runEndedError, sleeps, socketSources;
33475
+ var ended, sources, CLOSE_WAIT_MS, tracked, retiring, REQUEST_END_CALLS, runEnded, runEndedError, sleeps, socketSources;
33401
33476
  var init_runEnd = __esm({
33402
33477
  "wallet/src/net/runEnd.mjs"() {
33403
33478
  "use strict";
33404
33479
  init_globalDispatcher();
33405
33480
  ended = false;
33406
33481
  sources = /* @__PURE__ */ new Set();
33482
+ CLOSE_WAIT_MS = 3e4;
33483
+ tracked = /* @__PURE__ */ new WeakMap();
33484
+ retiring = /* @__PURE__ */ new WeakMap();
33485
+ REQUEST_END_CALLS = /* @__PURE__ */ new Set(["onComplete", "onError", "onUpgrade", "onResponseEnd", "onResponseError"]);
33407
33486
  runEnded = () => ended;
33408
33487
  runEndedError = () => Object.assign(new Error("run_ended"), { code: "run_ended" });
33409
33488
  sleeps = /* @__PURE__ */ new Set();
@@ -34969,14 +35048,15 @@ function tunnelClient(Dispatcher, proxyPort, proxyHost) {
34969
35048
  );
34970
35049
  }
34971
35050
  },
34972
- close: () => direct.close(),
34973
- destroy: (error) => direct.destroy(error)
35051
+ // Through runEnd.mjs (to-do 143): undici calls these only from the outer dispatcher's own close or destroy.
35052
+ close: () => closeDispatcher(direct),
35053
+ destroy: (error) => destroyDispatcher(direct, error)
34974
35054
  };
34975
35055
  }
34976
35056
  function proxyDispatcher(Dispatcher, proxy) {
34977
35057
  const url = new URL(proxy);
34978
35058
  const port = Number(url.port || (url.protocol === "https:" ? 443 : 80));
34979
- return new Dispatcher({
35059
+ return trackRequests(new Dispatcher({
34980
35060
  httpProxy: proxy,
34981
35061
  httpsProxy: proxy,
34982
35062
  noProxy: "",
@@ -34984,7 +35064,7 @@ function proxyDispatcher(Dispatcher, proxy) {
34984
35064
  keepAliveTimeout: KEEP_ALIVE_MS,
34985
35065
  keepAliveMaxTimeout: KEEP_ALIVE_MS,
34986
35066
  clientFactory: () => tunnelClient(Dispatcher, port, url.hostname)
34987
- });
35067
+ }));
34988
35068
  }
34989
35069
  function optimisticTarget(target) {
34990
35070
  return String(process.env[RUN_MARK] ?? "").startsWith("tor ") && /:443$/.test(target);
@@ -35278,14 +35358,9 @@ async function onOwnTagDispatcher(dispatcher, task) {
35278
35358
  return await ownTag.run(scope2, task);
35279
35359
  } finally {
35280
35360
  scope2.dispatcher = void 0;
35281
- const drop = () => {
35361
+ closeDispatcher(dispatcher).then(() => {
35282
35362
  ownTagDispatchers.delete(dispatcher);
35283
- };
35284
- try {
35285
- dispatcher.close().then(drop, drop);
35286
- } catch {
35287
- drop();
35288
- }
35363
+ });
35289
35364
  }
35290
35365
  }
35291
35366
  function routeDispatcherOf(url) {
@@ -35319,14 +35394,9 @@ function onionInit(init = {}) {
35319
35394
  function closeOnionDispatchersExcept(proxy) {
35320
35395
  for (const [tag2, dispatcher] of onionDispatchers) {
35321
35396
  if (tag2 === proxy) continue;
35322
- const drop = () => {
35397
+ closeDispatcher(dispatcher).then(() => {
35323
35398
  if (onionDispatchers.get(tag2) === dispatcher) onionDispatchers.delete(tag2);
35324
- };
35325
- try {
35326
- dispatcher.close().then(drop, drop);
35327
- } catch {
35328
- drop();
35329
- }
35399
+ });
35330
35400
  }
35331
35401
  }
35332
35402
  function untilAborted(promise, signal) {
@@ -37968,13 +38038,7 @@ function switchTorTag() {
37968
38038
  for (const one of /* @__PURE__ */ new Set([oldGlobal, nodeBuilt])) if (one !== void 0 && one !== activeGlobalDispatcher()) left.push(one);
37969
38039
  laneDispatchers.clear();
37970
38040
  setImmediate(() => {
37971
- for (const dispatcher of left) {
37972
- try {
37973
- dispatcher.close().catch(() => {
37974
- });
37975
- } catch {
37976
- }
37977
- }
38041
+ for (const dispatcher of left) closeDispatcher(dispatcher);
37978
38042
  closeOnionDispatchersExcept(env.HTTP_PROXY);
37979
38043
  });
37980
38044
  torCircuitId += 1;
@@ -38004,11 +38068,7 @@ function dropTorLane(lane) {
38004
38068
  if (dispatcher === void 0) return;
38005
38069
  laneDispatchers.delete(lane);
38006
38070
  setImmediate(() => {
38007
- try {
38008
- dispatcher.close().catch(() => {
38009
- });
38010
- } catch {
38011
- }
38071
+ closeDispatcher(dispatcher);
38012
38072
  });
38013
38073
  } catch {
38014
38074
  }
@@ -43380,6 +43440,7 @@ var init_errorCodes = __esm({
43380
43440
  "inference_max_payment_invalid",
43381
43441
  "inference_max_tokens_required",
43382
43442
  "inference_max_tokens_too_low",
43443
+ "inference_recovery_max_tokens_mismatch",
43383
43444
  "inference_messages_invalid",
43384
43445
  "inference_tools_invalid",
43385
43446
  "inference_model_unknown",
@@ -69924,7 +69985,7 @@ function floatRefundHeld(snapshot, record) {
69924
69985
  function floatRecordState(record) {
69925
69986
  return record?.state === "refund_pending" && record.ambiguous === true ? "submitted" : record?.state;
69926
69987
  }
69927
- var import_web3114, MAX_BODY_BYTES, REFUND_OUTCOME_NEWS_MS, RESULT_LIMIT_BYTES, RESIGN_ANSWER_MAX_BYTES, PAYMENT_TIME_MIN_MS, PAYMENT_TIME_MAX_MS, TRANSFER_LANDING_WINDOW_MS, PROOF_DELIVERY_MS, SELF_BROADCAST_LEG1_LEFT_MS, SELLER_HEADERS_MAX_BYTES;
69988
+ var import_web3114, MAX_BODY_BYTES, REFUND_OUTCOME_NEWS_MS, RESULT_LIMIT_BYTES, EARLY_READS_MS, RESIGN_ANSWER_MAX_BYTES, PAYMENT_TIME_MIN_MS, PAYMENT_TIME_MAX_MS, TRANSFER_LANDING_WINDOW_MS, PROOF_DELIVERY_MS, SELF_BROADCAST_LEG1_LEFT_MS, SELLER_HEADERS_MAX_BYTES;
69928
69989
  var init_floatPay = __esm({
69929
69990
  "wallet/src/pay/floatPay.mjs"() {
69930
69991
  "use strict";
@@ -69960,6 +70021,7 @@ var init_floatPay = __esm({
69960
70021
  MAX_BODY_BYTES = 12 * 1024;
69961
70022
  REFUND_OUTCOME_NEWS_MS = 24 * 60 * 60 * 1e3;
69962
70023
  RESULT_LIMIT_BYTES = 1024 * 1024;
70024
+ EARLY_READS_MS = Object.freeze([1e3, 2e3]);
69963
70025
  RESIGN_ANSWER_MAX_BYTES = 128 * 1024;
69964
70026
  PAYMENT_TIME_MIN_MS = Date.UTC(2024, 0, 1);
69965
70027
  PAYMENT_TIME_MAX_MS = Date.UTC(9999, 11, 31);
@@ -81044,6 +81106,7 @@ startStallCloser();
81044
81106
 
81045
81107
  // wallet/src/seller/setup.mjs
81046
81108
  init_tunnelGuard();
81109
+ init_runEnd();
81047
81110
  init_serviceUrl();
81048
81111
  init_backup();
81049
81112
  init_files();
@@ -81155,8 +81218,7 @@ Or run ${cli()} seller setup again and choose no Tor.`
81155
81218
  const dispatcher = proxyDispatcher(proxyDispatcherClass(), tagged.href.replace(/\/$/, ""));
81156
81219
  return {
81157
81220
  fetch: (input, init = {}) => fetch(input, { ...init, dispatcher }),
81158
- close: () => dispatcher.close().catch(() => {
81159
- })
81221
+ close: () => closeDispatcher(dispatcher)
81160
81222
  };
81161
81223
  }
81162
81224
  var usdc = (atomic4) => {