shinjuku-shielded 0.3.32 → 0.3.33

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/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": "3ec79a8335ea99f87cf8f2c34ea8723c70a30bd6f30fc5c0fb177edfa1816714",
5
- "bytes": 11184498,
6
- "sourceCommit": "8bd35a850efa3fb8dac143ea02a6d02a3f4008c6",
4
+ "sha256": "dae9ba8800e48179602d5595c5bbc71029a758be726e72482d24a52126649ac9",
5
+ "bytes": 11184999,
6
+ "sourceCommit": "5a445fbb0e06e50a3365809a078f3d5b0de03c51",
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",
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "shinjuku-shielded",
3
- "version": "0.3.32",
3
+ "version": "0.3.33",
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": "3ec79a83",
7
- "shinjukuSha256": "3ec79a8335ea99f87cf8f2c34ea8723c70a30bd6f30fc5c0fb177edfa1816714",
6
+ "shinjukuRelease": "dae9ba88",
7
+ "shinjukuSha256": "dae9ba8800e48179602d5595c5bbc71029a758be726e72482d24a52126649ac9",
8
8
  "license": "SEE LICENSE IN LICENSE.txt",
9
9
  "author": "Shinjuku Shielded",
10
10
  "homepage": "https://github.com/ShinjukuStaition/shinjuku-mcp#readme",
@@ -46392,6 +46392,28 @@ var init_ohttp = __esm({
46392
46392
  }
46393
46393
  });
46394
46394
 
46395
+ // wallet/src/pay/phaseTiming.mjs
46396
+ import { AsyncLocalStorage } from "node:async_hooks";
46397
+ function withPhaseScope(mark, prefix, fn) {
46398
+ if (typeof mark !== "function") return fn();
46399
+ const outer = scope.getStore();
46400
+ const write = (phase) => mark(`${prefix}:${phase}`);
46401
+ return scope.run(outer ? (phase) => outer(`${prefix}:${phase}`) : write, fn);
46402
+ }
46403
+ function markPhase(phase) {
46404
+ try {
46405
+ scope.getStore()?.(phase);
46406
+ } catch {
46407
+ }
46408
+ }
46409
+ var scope;
46410
+ var init_phaseTiming = __esm({
46411
+ "wallet/src/pay/phaseTiming.mjs"() {
46412
+ "use strict";
46413
+ scope = new AsyncLocalStorage();
46414
+ }
46415
+ });
46416
+
46395
46417
  // wallet/src/net/proxy.mjs
46396
46418
  import { spawn } from "node:child_process";
46397
46419
  import { randomBytes as randomBytes5 } from "node:crypto";
@@ -46575,7 +46597,15 @@ function describeRpcPost(input, body) {
46575
46597
  const calls = Array.isArray(parsed) ? parsed : [parsed];
46576
46598
  const resendable = calls.length > 0 && calls.every((call3) => typeof call3?.method === "string" && RESENDABLE_METHOD.test(call3.method));
46577
46599
  const method = Array.isArray(parsed) ? "batch" : parsed?.method;
46578
- return { key: `${new URL(input instanceof Request ? input.url : String(input)).origin} ${method ?? ""}`, resendable };
46600
+ return {
46601
+ key: `${new URL(input instanceof Request ? input.url : String(input)).origin} ${method ?? ""}`,
46602
+ resendable,
46603
+ // The method in a timing mark: a JSON-RPC method name only, else "other".
46604
+ mark: typeof method === "string" && /^[A-Za-z]{1,40}$/.test(method) ? method : "other"
46605
+ };
46606
+ }
46607
+ function markRefusal(response, post) {
46608
+ if (response.status === 429 || response.status === 503) markPhase(`rpc-${response.status}-${post?.mark ?? "other"}`);
46579
46609
  }
46580
46610
  function noteAnswer(response) {
46581
46611
  if (!response.ok) return;
@@ -46607,6 +46637,7 @@ async function rpcFetch(input, init) {
46607
46637
  if (!post?.resendable) {
46608
46638
  const response = await fetch(input, init);
46609
46639
  noteAnswer(response);
46640
+ markRefusal(response, post);
46610
46641
  return response;
46611
46642
  }
46612
46643
  let strikes = 0;
@@ -46617,9 +46648,11 @@ async function rpcFetch(input, init) {
46617
46648
  if (stop2) throw new Error(`rpc_rate_limited: ${stop2}`);
46618
46649
  waited = true;
46619
46650
  }
46651
+ if (waited) markPhase(`rpc-paced-${post.mark}`);
46620
46652
  const circuit = torRotations;
46621
46653
  const response = await fetch(input, init);
46622
46654
  noteAnswer(response);
46655
+ markRefusal(response, post);
46623
46656
  if (response.status !== 429) return response;
46624
46657
  await response.body?.cancel().catch(() => {
46625
46658
  });
@@ -46709,6 +46742,7 @@ var init_proxy = __esm({
46709
46742
  "use strict";
46710
46743
  init_facilitatorOnion();
46711
46744
  init_ohttp();
46745
+ init_phaseTiming();
46712
46746
  TOR_HTTP_TUNNEL = "http://127.0.0.1:9080";
46713
46747
  TOR_CHECK = "https://check.torproject.org/api/ip";
46714
46748
  PROOF_TIMEOUT_MS = 2e4;
@@ -49625,28 +49659,6 @@ var init_serviceUrl = __esm({
49625
49659
  }
49626
49660
  });
49627
49661
 
49628
- // wallet/src/pay/phaseTiming.mjs
49629
- import { AsyncLocalStorage } from "node:async_hooks";
49630
- function withPhaseScope(mark, prefix, fn) {
49631
- if (typeof mark !== "function") return fn();
49632
- const outer = scope.getStore();
49633
- const write = (phase) => mark(`${prefix}:${phase}`);
49634
- return scope.run(outer ? (phase) => outer(`${prefix}:${phase}`) : write, fn);
49635
- }
49636
- function markPhase(phase) {
49637
- try {
49638
- scope.getStore()?.(phase);
49639
- } catch {
49640
- }
49641
- }
49642
- var scope;
49643
- var init_phaseTiming = __esm({
49644
- "wallet/src/pay/phaseTiming.mjs"() {
49645
- "use strict";
49646
- scope = new AsyncLocalStorage();
49647
- }
49648
- });
49649
-
49650
49662
  // wallet/src/anchorClock.mjs
49651
49663
  function observePoolAnchors(state, nowMs = Date.now()) {
49652
49664
  try {
@@ -126143,7 +126155,7 @@ function createWalletTools({
126143
126155
  return;
126144
126156
  }
126145
126157
  if (!stale || refreshFailedAt && Date.now() - refreshFailedAt < REFRESH_RETRY_MS) return;
126146
- if (refreshRun && refreshInBackground) return;
126158
+ if (finalityWait || refreshRun && refreshInBackground) return;
126147
126159
  await refreshShared().catch(() => {
126148
126160
  });
126149
126161
  }