shinjuku-shielded 0.3.60 → 0.3.62

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": "ad143a47257fa8b5e147ba3f6b662576794b06184abbedce42fd4f74993d9b7e",
5
- "bytes": 12161659,
6
- "sourceCommit": "187538a77af6d819ea08912f6406834a8e144e22",
4
+ "sha256": "d9319f9cc0d4e5deebfa15e1ac35bee0bc4f4ffb95cd4f58e400ee322ac11076",
5
+ "bytes": 12167009,
6
+ "sourceCommit": "ae2f0123e2d006af49b3e33fd15ac30dd0d95222",
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",
@@ -1282,5 +1282,5 @@
1282
1282
  "version": "1.8.0"
1283
1283
  }
1284
1284
  ],
1285
- "publishedAt": "2026-10-22T05:12:25.176Z"
1285
+ "publishedAt": "2026-10-22T06:56:59.253Z"
1286
1286
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "shinjuku-shielded",
3
- "version": "0.3.60",
3
+ "version": "0.3.62",
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": "ad143a47",
7
- "shinjukuSha256": "ad143a47257fa8b5e147ba3f6b662576794b06184abbedce42fd4f74993d9b7e",
6
+ "shinjukuRelease": "d9319f9c",
7
+ "shinjukuSha256": "d9319f9cc0d4e5deebfa15e1ac35bee0bc4f4ffb95cd4f58e400ee322ac11076",
8
8
  "license": "SEE LICENSE IN LICENSE.txt",
9
9
  "author": "Shinjuku Shielded",
10
10
  "homepage": "https://github.com/ShinjukuStaition/shinjuku-mcp#readme",
@@ -47661,7 +47661,7 @@ function readE1TreeAccount(bytes2) {
47661
47661
  leaves: v.getUint32(RIGHTMOST_OFFSET + 32 * D + 32, true)
47662
47662
  };
47663
47663
  }
47664
- var E1, E1_VALUES_PER_TAG, E1_INPUTS_PER_TAG, E1_REPLAY_INPUT_INDICES, E1_ERROR_CODES, D, B, C, LOWER, TREE_MAGIC, CHANGELOG_BYTES, CHANGELOGS_OFFSET, RIGHTMOST_OFFSET, CANOPY_OFFSET, CANOPY_NODES, ZERO, MAX2, fail, eq32, isZero, u32le, asValue, node, EMPTY_NODES, hashToParent, B58, R_FIELD, CPROOF, bigOf, isCanonical, E1_LOADED_ACCOUNT_SIZES, ACCOUNT_OVERHEAD, sizeOk, hexOf, E1TreeMirror;
47664
+ var E1, E1_VALUES_PER_TAG, E1_INPUTS_PER_TAG, E1_REPLAY_INPUT_INDICES, E1_ERROR_CODES, D, B, C, LOWER, TREE_MAGIC, CHANGELOG_BYTES, CHANGELOGS_OFFSET, RIGHTMOST_OFFSET, CANOPY_OFFSET, CANOPY_NODES, ZERO, MAX2, fail, eq32, isZero, u32le, asValue, node, EMPTY_NODES, hashToParent, B58, R_FIELD, CPROOF, bigOf, isCanonical, E1_LOADED_ACCOUNT_SIZES, ACCOUNT_OVERHEAD, sizeOk, hexOf, BUILD_STEP_NODES, E1TreeMirror;
47665
47665
  var init_p03E1Tree = __esm({
47666
47666
  "wallet/vendor/shared/p03E1Tree.mjs"() {
47667
47667
  "use strict";
@@ -47772,6 +47772,7 @@ var init_p03E1Tree = __esm({
47772
47772
  for (const x of b) s4 += x.toString(16).padStart(2, "0");
47773
47773
  return s4;
47774
47774
  };
47775
+ BUILD_STEP_NODES = 64;
47775
47776
  E1TreeMirror = class _E1TreeMirror {
47776
47777
  #levels;
47777
47778
  // #levels[l][i] = node at level l (0 = leaves), undefined = empty subtree
@@ -47789,14 +47790,28 @@ var init_p03E1Tree = __esm({
47789
47790
  }
47790
47791
  /** Sentinel, then every value in the given order (chain order, each settle already sorted). */
47791
47792
  static fromOrderedValues(values) {
47793
+ const build2 = _E1TreeMirror.fromOrderedValuesSteps(values);
47794
+ for (; ; ) {
47795
+ const step = build2.next();
47796
+ if (step.done) return step.value;
47797
+ }
47798
+ }
47799
+ /**
47800
+ * fromOrderedValues in steps, for a caller that keeps its thread free between them (the wallet
47801
+ * builds the tree of its cached settles at start, in slices): one step per value inserted and per
47802
+ * BUILD_STEP_NODES hashes. The generator returns the mirror fromOrderedValues returns, and throws
47803
+ * where it throws.
47804
+ */
47805
+ static *fromOrderedValuesSteps(values) {
47792
47806
  const m = new _E1TreeMirror();
47793
47807
  m.#sorted.push(m.#pushLeaf({ value: ZERO, nextValue: MAX2, nextIndex: 0 }));
47794
47808
  for (const v of values) {
47795
47809
  asValue(v);
47796
47810
  if (isZero(v)) fail("p03_e1_value_zero");
47797
47811
  m.#linkInsert(v);
47812
+ yield;
47798
47813
  }
47799
- m.#rebuildNodes();
47814
+ yield* m.#rebuildNodes();
47800
47815
  return m;
47801
47816
  }
47802
47817
  clone() {
@@ -47918,11 +47933,20 @@ var init_p03E1Tree = __esm({
47918
47933
  this.#levels[l + 1][i >>> 1] = n;
47919
47934
  }
47920
47935
  }
47921
- #rebuildNodes() {
47922
- this.#levels[0] = this.#leaves.map((l) => e1LeafHash(l));
47936
+ // Every node from the leaves up, a step per BUILD_STEP_NODES hashes (fromOrderedValuesSteps).
47937
+ *#rebuildNodes() {
47938
+ const hashed = new Array(this.#leaves.length);
47939
+ for (let i = 0; i < hashed.length; i++) {
47940
+ hashed[i] = e1LeafHash(this.#leaves[i]);
47941
+ if ((i + 1) % BUILD_STEP_NODES === 0) yield;
47942
+ }
47943
+ this.#levels[0] = hashed;
47923
47944
  for (let l = 0; l < D; l++) {
47924
47945
  const below = this.#levels[l], up = new Array(Math.ceil(below.length / 2));
47925
- for (let i = 0; i < up.length; i++) up[i] = node(below[2 * i], below[2 * i + 1] ?? EMPTY_NODES[l]);
47946
+ for (let i = 0; i < up.length; i++) {
47947
+ up[i] = node(below[2 * i], below[2 * i + 1] ?? EMPTY_NODES[l]);
47948
+ if ((i + 1) % BUILD_STEP_NODES === 0) yield;
47949
+ }
47926
47950
  this.#levels[l + 1] = up;
47927
47951
  }
47928
47952
  }
@@ -54664,19 +54688,70 @@ function initializationReplayStore(instruction) {
54664
54688
  if (data.length === 123 && data[122] === REPLAY_STORE_INDEXED) return REPLAY_STORE_INDEXED;
54665
54689
  return void 0;
54666
54690
  }
54667
- function replayedE1Mirror(key, settles, matchesChain) {
54691
+ function e1SettleCopies(settles) {
54668
54692
  const wellFormed2 = settles.every((values) => Array.isArray(values) && values.every((value) => value instanceof Uint8Array && value.length === 32));
54669
- const copies = wellFormed2 ? settles.map((values) => values.map((value) => Uint8Array.from(value))) : settles;
54670
- const settleKeys = wellFormed2 ? copies.map((values) => values.map((value) => Buffer.from(value).toString("hex")).join("")) : void 0;
54693
+ if (!wellFormed2) return { copies: settles, keys: void 0 };
54694
+ const copies = settles.map((values) => values.map((value) => Uint8Array.from(value)));
54695
+ return { copies, keys: copies.map((values) => values.map((value) => Buffer.from(value).toString("hex")).join("")) };
54696
+ }
54697
+ function runE1TreeCandidate(candidate, untilMs = Infinity) {
54698
+ try {
54699
+ while (candidate.mirror === void 0 && !candidate.failed) {
54700
+ const step = candidate.build.next();
54701
+ if (step.done) candidate.mirror = step.value;
54702
+ else if (performance.now() >= untilMs) break;
54703
+ }
54704
+ } catch {
54705
+ candidate.failed = true;
54706
+ }
54707
+ return candidate.failed ? void 0 : candidate.mirror;
54708
+ }
54709
+ function startE1TreeCandidate({ key, settles, sliceMs = 8 }) {
54710
+ try {
54711
+ if (lastVerifiedE1Tree?.key === key || e1TreeCandidate?.key === key) return void 0;
54712
+ const { copies, keys: keys3 } = e1SettleCopies(settles);
54713
+ if (keys3 === void 0) return void 0;
54714
+ const candidate = {
54715
+ key,
54716
+ settles: keys3,
54717
+ build: E1TreeMirror.fromOrderedValuesSteps(copies.flatMap((values) => e1SortValues(values))),
54718
+ mirror: void 0,
54719
+ failed: false
54720
+ };
54721
+ e1TreeCandidate = candidate;
54722
+ let hurry = false;
54723
+ const done = (async () => {
54724
+ while (e1TreeCandidate === candidate && candidate.mirror === void 0 && !candidate.failed) {
54725
+ runE1TreeCandidate(candidate, hurry ? Infinity : performance.now() + sliceMs);
54726
+ if (candidate.mirror === void 0 && !candidate.failed) await new Promise((resolve38) => setImmediate(resolve38));
54727
+ }
54728
+ return candidate.mirror !== void 0 && !candidate.failed;
54729
+ })();
54730
+ return { done, hurry: () => {
54731
+ hurry = true;
54732
+ } };
54733
+ } catch {
54734
+ return void 0;
54735
+ }
54736
+ }
54737
+ function replayedE1Mirror(key, settles, matchesChain) {
54738
+ const { copies, keys: settleKeys } = e1SettleCopies(settles);
54739
+ const wellFormed2 = settleKeys !== void 0;
54740
+ const startsThis = (kept) => kept.length <= settleKeys.length && kept.every((value, index) => value === settleKeys[index]);
54741
+ const candidate = e1TreeCandidate?.key === key ? e1TreeCandidate : void 0;
54742
+ if (candidate !== void 0) e1TreeCandidate = void 0;
54671
54743
  const last = lastVerifiedE1Tree;
54672
- if (wellFormed2 && last?.key === key && last.settles.length <= settleKeys.length && last.settles.every((value, index) => value === settleKeys[index])) {
54744
+ const base = !wellFormed2 ? void 0 : last?.key === key && startsThis(last.settles) ? { settles: last.settles, mirror: () => last.mirror.clone(), count: "extended" } : candidate !== void 0 && startsThis(candidate.settles) ? { settles: candidate.settles, mirror: () => runE1TreeCandidate(candidate), count: "candidate" } : void 0;
54745
+ if (base !== void 0) {
54673
54746
  try {
54674
- const mirror2 = last.mirror.clone();
54675
- for (const values of copies.slice(last.settles.length)) mirror2.insertSettle(values);
54676
- if (matchesChain(mirror2)) {
54677
- lastVerifiedE1Tree = { key, settles: settleKeys, mirror: mirror2 };
54678
- e1ReplayCounts.extended += 1;
54679
- return mirror2;
54747
+ const mirror2 = base.mirror();
54748
+ if (mirror2 !== void 0) {
54749
+ for (const values of copies.slice(base.settles.length)) mirror2.insertSettle(values);
54750
+ if (matchesChain(mirror2)) {
54751
+ lastVerifiedE1Tree = { key, settles: settleKeys, mirror: mirror2 };
54752
+ e1ReplayCounts[base.count] += 1;
54753
+ return mirror2;
54754
+ }
54680
54755
  }
54681
54756
  } catch {
54682
54757
  }
@@ -55528,7 +55603,7 @@ function base58Decode(value) {
55528
55603
  while (zeros < value.length && value[zeros] === "1") zeros += 1;
55529
55604
  return Uint8Array.from(Buffer.concat([Buffer.alloc(zeros), body]));
55530
55605
  }
55531
- var import_web396, b58Cache, b58, REPLAY_STORE_INDEXED, CLOSE_REPLAY_TREE_TAG, EXTEND_ANCHOR_RING_TAG, WIDEN_ANCHOR_RING_TAG, WIDE_ANCHOR_RING_POOL_BYTES, LINK_SUCCESSOR_TAG, IMPORT_REPLAY_LEAVES_TAG, SETTLE_MOVE_TAG, SWEEP_PREDECESSOR_VAULT_TAG, RELINK_SUCCESSOR_TAG, ROTATE_PAYMENT_SETTLER_TAG, IMPORT_A_LEAF_BYTES, IMPORT_MEMBERSHIP_BYTES, IMPORT_PRESENT_SHIFT, IMPORT_MAX_ENTRIES, MOVE_HEAD_BYTES, MOVE_INSERTED_VALUES, DEFAULT_KEY, FIELD_BYTES2, PRIMARY_PROOF_BYTES, SUBTREE_LEAVES, PAGE_SIZE, FIELD_MODULUS3, BPF_LOADER_UPGRADEABLE_PROGRAM_ID, SYSTEM_PROGRAM, TEST_EXECUTABLES, derivationMemo, memo, reviewedExecutables, isProgramDataIdentityError, ASSUMED_ORIGINAL_EXECUTABLE, AUTHENTICATED_HISTORY_REPORTS, HISTORY_ATTESTATIONS, SNAPSHOT_POOL_STATES, REPORT_POOL_STATES, hasExecutableEvidence, P03_FINALIZED_HISTORY_SOURCE_MODEL, P03_PROGRAMDATA_COVERAGE_SOURCE_MODEL, P03_RUN_RECOVER_UNAVAILABLE_FROM_CHAIN, PROFILES, P03_SETTLEMENT_TAGS, P03_INLINE_SETTLEMENT_TAGS, P03_PAYMENT_REPLAY_INDICES, NO_CONTEXTS, REFRESH_READ_BYTES, E1_TREE_HEADER_BYTES, E1_TREE_MAGIC, E1_CHANGELOG_BYTES, E1_CHANGELOGS_OFFSET, E1_RIGHTMOST_OFFSET, E1_LEAF_COUNT_OFFSET, E1_CANOPY_OFFSET, E1_CANOPY_NODES, P03_POOL_SLICES_METHOD, POOL_SLICES, SLICED_ROOTS_OFFSET, SLICED_LEAVES_OFFSET, SLICES_REFUSED_ENDPOINTS, SLICES_REFUSED_CONNECTIONS, HISTORY_FETCH_CONCURRENCY, HISTORY_BULK_TRANSACTIONS, HISTORY_BULK_ADDRESSES, TRANSIENT_RPC_ATTEMPTS, TRANSIENT_RPC_BASE_DELAY_MS, LAGGING_NODE_STEP_OF_BASE, LAGGING_NODE_MAX_RETRIES, LAGGING_NODE_FAST_RETRIES, LAGGING_NODE_SLOW_STEP_OF_BASE, LAGGING_NODE_RPC_CODES, lastVerifiedE1Tree, e1ReplayCounts;
55606
+ var import_web396, b58Cache, b58, REPLAY_STORE_INDEXED, CLOSE_REPLAY_TREE_TAG, EXTEND_ANCHOR_RING_TAG, WIDEN_ANCHOR_RING_TAG, WIDE_ANCHOR_RING_POOL_BYTES, LINK_SUCCESSOR_TAG, IMPORT_REPLAY_LEAVES_TAG, SETTLE_MOVE_TAG, SWEEP_PREDECESSOR_VAULT_TAG, RELINK_SUCCESSOR_TAG, ROTATE_PAYMENT_SETTLER_TAG, IMPORT_A_LEAF_BYTES, IMPORT_MEMBERSHIP_BYTES, IMPORT_PRESENT_SHIFT, IMPORT_MAX_ENTRIES, MOVE_HEAD_BYTES, MOVE_INSERTED_VALUES, DEFAULT_KEY, FIELD_BYTES2, PRIMARY_PROOF_BYTES, SUBTREE_LEAVES, PAGE_SIZE, FIELD_MODULUS3, BPF_LOADER_UPGRADEABLE_PROGRAM_ID, SYSTEM_PROGRAM, TEST_EXECUTABLES, derivationMemo, memo, reviewedExecutables, isProgramDataIdentityError, ASSUMED_ORIGINAL_EXECUTABLE, AUTHENTICATED_HISTORY_REPORTS, HISTORY_ATTESTATIONS, SNAPSHOT_POOL_STATES, REPORT_POOL_STATES, hasExecutableEvidence, P03_FINALIZED_HISTORY_SOURCE_MODEL, P03_PROGRAMDATA_COVERAGE_SOURCE_MODEL, P03_RUN_RECOVER_UNAVAILABLE_FROM_CHAIN, PROFILES, P03_SETTLEMENT_TAGS, P03_INLINE_SETTLEMENT_TAGS, P03_PAYMENT_REPLAY_INDICES, NO_CONTEXTS, REFRESH_READ_BYTES, E1_TREE_HEADER_BYTES, E1_TREE_MAGIC, E1_CHANGELOG_BYTES, E1_CHANGELOGS_OFFSET, E1_RIGHTMOST_OFFSET, E1_LEAF_COUNT_OFFSET, E1_CANOPY_OFFSET, E1_CANOPY_NODES, P03_POOL_SLICES_METHOD, POOL_SLICES, SLICED_ROOTS_OFFSET, SLICED_LEAVES_OFFSET, SLICES_REFUSED_ENDPOINTS, SLICES_REFUSED_CONNECTIONS, HISTORY_FETCH_CONCURRENCY, HISTORY_BULK_TRANSACTIONS, HISTORY_BULK_ADDRESSES, TRANSIENT_RPC_ATTEMPTS, TRANSIENT_RPC_BASE_DELAY_MS, LAGGING_NODE_STEP_OF_BASE, LAGGING_NODE_MAX_RETRIES, LAGGING_NODE_FAST_RETRIES, LAGGING_NODE_SLOW_STEP_OF_BASE, LAGGING_NODE_RPC_CODES, lastVerifiedE1Tree, e1ReplayCounts, e1TreeCandidate;
55532
55607
  var init_walk = __esm({
55533
55608
  "wallet/src/history/walk.mjs"() {
55534
55609
  "use strict";
@@ -55817,7 +55892,7 @@ var init_walk = __esm({
55817
55892
  LAGGING_NODE_FAST_RETRIES = 5;
55818
55893
  LAGGING_NODE_SLOW_STEP_OF_BASE = 4.6;
55819
55894
  LAGGING_NODE_RPC_CODES = /* @__PURE__ */ new Set([-32004, -32016]);
55820
- e1ReplayCounts = { full: 0, extended: 0 };
55895
+ e1ReplayCounts = { full: 0, extended: 0, candidate: 0 };
55821
55896
  }
55822
55897
  });
55823
55898
 
@@ -56737,6 +56812,31 @@ function startCompactPreFold(pool2, cached) {
56737
56812
  preFolds.set(pool2, preFold);
56738
56813
  return preFold;
56739
56814
  }
56815
+ function startCompactE1Candidate(programId, pool2, cached, preFold) {
56816
+ const records = cached?.served?.records;
56817
+ if (!Array.isArray(records) || records.length === 0) return void 0;
56818
+ let hurry = false;
56819
+ let running;
56820
+ const done = (async () => {
56821
+ await (preFold?.done ?? new Promise((resolve38) => setImmediate(resolve38)));
56822
+ if (initializationReplayStore(cached.initialization) !== REPLAY_STORE_INDEXED2) return void 0;
56823
+ const contexts = records.map((record) => ({
56824
+ kind: record.kind,
56825
+ provenance: { slot: record.slot, transactionIndex: record.transactionIndex, instructionIndex: record.instructionIndex },
56826
+ replayValues: record.replayValues.map((value) => fieldOf(value))
56827
+ }));
56828
+ const imports = (Array.isArray(cached.served.imports) ? cached.served.imports : []).map((entry) => validateImport(entry, void 0));
56829
+ running = startE1TreeCandidate({ key: `${programId}:${pool2}`, settles: compactTreeSettles(contexts, imports) });
56830
+ if (running === void 0) return markPhase("compact-e1-ahead-skipped");
56831
+ markPhase("compact-e1-ahead-start");
56832
+ if (hurry) running.hurry();
56833
+ return markPhase(await running.done ? "compact-e1-ahead-done" : "compact-e1-ahead-dropped");
56834
+ })().catch(() => markPhase("compact-e1-ahead-skipped"));
56835
+ return { done, hurry: () => {
56836
+ hurry = true;
56837
+ running?.hurry();
56838
+ } };
56839
+ }
56740
56840
  function sparseRoots(roots, count2) {
56741
56841
  const array = new Array(count2 + 1);
56742
56842
  array[0] = zeroRoots()[OUTER_DEPTH2];
@@ -57707,6 +57807,7 @@ async function compactP03HistoryReportRun({
57707
57807
  }
57708
57808
  };
57709
57809
  const preFold = cached ? startCompactPreFold(poolKey.toBase58(), cached) : void 0;
57810
+ const e1Ahead = cached ? startCompactE1Candidate(program.toBase58(), poolKey.toBase58(), cached, preFold) : void 0;
57710
57811
  const compact = await readCompactP03History({
57711
57812
  history,
57712
57813
  own: connection,
@@ -57733,6 +57834,10 @@ async function compactP03HistoryReportRun({
57733
57834
  let e1Tree;
57734
57835
  if (snapshot.replayStore === REPLAY_STORE_INDEXED2) {
57735
57836
  try {
57837
+ if (e1Ahead !== void 0) {
57838
+ e1Ahead.hurry();
57839
+ await e1Ahead.done;
57840
+ }
57736
57841
  e1Tree = assertP03E1TreeComplete({
57737
57842
  program,
57738
57843
  pool: poolKey,
@@ -124687,6 +124792,17 @@ async function openWalletServer({
124687
124792
  if (typeof tools.warmHistory === "function") tools.warmHistory({ afterBoot: warmDiscover });
124688
124793
  else warmDiscover?.();
124689
124794
  let rootsLanded = Promise.resolve();
124795
+ let toolRootsLanded;
124796
+ const rootsForTools = (install, started) => {
124797
+ let timer;
124798
+ const bound = new Promise((done) => {
124799
+ timer = setTimeout(done, TOOL_ROOTS_WAIT_MS);
124800
+ timer.unref?.();
124801
+ });
124802
+ return Promise.race([Promise.resolve(install).then(() => {
124803
+ }, () => {
124804
+ }), bound]).finally(() => clearTimeout(timer)).then(() => started);
124805
+ };
124690
124806
  if (proofToolsRefresh?.home) {
124691
124807
  let timer;
124692
124808
  const late2 = new Promise((done) => {
@@ -124712,15 +124828,19 @@ async function openWalletServer({
124712
124828
  setFamilyRootResolver(() => void 0);
124713
124829
  return { state: "unproven" };
124714
124830
  };
124715
- const land = Promise.race([install(), late2]).finally(() => clearTimeout(timer)).then((installed) => {
124831
+ const installing = install();
124832
+ const land = Promise.race([installing, late2]).finally(() => clearTimeout(timer)).then((installed) => {
124716
124833
  if (installed.state === "timeout") setFamilyRootResolver(() => void 0);
124717
124834
  if (installed.state !== "none") log(`FAMILY_ROOTS ${installed.state}${installed.seq === void 0 ? "" : ` seq=${installed.seq}`}${installed.count === void 0 ? "" : ` count=${installed.count}`}${installed.code ? ` code=${installed.code}` : ""}`);
124718
124835
  });
124719
124836
  if (!rootsInBackground) await land;
124720
- else rootsLanded = land.catch((error) => {
124721
- setFamilyRootResolver(() => void 0);
124722
- log(`FAMILY_ROOTS failed code=${String(error?.message ?? error).split(/[\s:;(]/, 1)[0]}`);
124723
- });
124837
+ else {
124838
+ rootsLanded = land.catch((error) => {
124839
+ setFamilyRootResolver(() => void 0);
124840
+ log(`FAMILY_ROOTS failed code=${String(error?.message ?? error).split(/[\s:;(]/, 1)[0]}`);
124841
+ });
124842
+ toolRootsLanded = rootsForTools(installing, rootsLanded);
124843
+ }
124724
124844
  } else if (rootsInBackground && cliRootsLate !== void 0) {
124725
124845
  let timer;
124726
124846
  const late2 = new Promise((done) => {
@@ -124733,6 +124853,7 @@ async function openWalletServer({
124733
124853
  setFamilyRootResolver(() => void 0);
124734
124854
  log("FAMILY_ROOTS timeout");
124735
124855
  });
124856
+ toolRootsLanded = rootsForTools(cliRootsLate, rootsLanded);
124736
124857
  }
124737
124858
  if (rootsInBackground) {
124738
124859
  for (let index = 0; index < tools.length; index += 1) {
@@ -124740,7 +124861,7 @@ async function openWalletServer({
124740
124861
  if (ROOTS_FREE_TOOLS.has(tool.name)) continue;
124741
124862
  tools[index] = { ...tool, run: async (...args) => {
124742
124863
  const startedAt = Date.now();
124743
- await rootsLanded;
124864
+ await (toolRootsLanded ?? rootsLanded);
124744
124865
  if (Date.now() - startedAt >= 20) log(`MCP_ROOTS_WAIT tool=${tool.name} ms=${Date.now() - startedAt}`);
124745
124866
  return tool.run(...args);
124746
124867
  } };
@@ -125018,7 +125139,7 @@ async function runSetupModeServer({
125018
125139
  }
125019
125140
  return { closed: ended };
125020
125141
  }
125021
- var import_web3134, SUPPORTED_PROTOCOL_VERSIONS, SERVER_VERSION, MAX_LINE_BYTES, POSITIVE_ATOMIC7, INSTRUCTIONS, MCP_LOG_LEVELS, POOL_SWITCH_LOG_LEVEL, validId, BUNDLED_SOURCE_DIR, SHA256_HEX, UPDATE_NOTICE_TOOLS, UPDATE_NOTICE_MAX_TEXT, UPDATE_NOTICE_TEXT, updateNoticeLine, LAUNCH_NOTICE_TOOLS, withLaunchLine, capRequired, setupInvalid, ROOTS_FREE_TOOLS, MCP_CLOSE_BOUND_MS, MCP_CLOSE_HISTORY_BOUND_MS, MCP_CLOSE_UNREADABLE_BOUND_MS, MCP_CLOSE_POLL_MS, closeHistoryBusy, SETUP_INSTRUCTIONS;
125142
+ var import_web3134, SUPPORTED_PROTOCOL_VERSIONS, SERVER_VERSION, MAX_LINE_BYTES, POSITIVE_ATOMIC7, INSTRUCTIONS, MCP_LOG_LEVELS, POOL_SWITCH_LOG_LEVEL, validId, BUNDLED_SOURCE_DIR, SHA256_HEX, UPDATE_NOTICE_TOOLS, UPDATE_NOTICE_MAX_TEXT, UPDATE_NOTICE_TEXT, updateNoticeLine, LAUNCH_NOTICE_TOOLS, withLaunchLine, capRequired, setupInvalid, TOOL_ROOTS_WAIT_MS, ROOTS_FREE_TOOLS, MCP_CLOSE_BOUND_MS, MCP_CLOSE_HISTORY_BOUND_MS, MCP_CLOSE_UNREADABLE_BOUND_MS, MCP_CLOSE_POLL_MS, closeHistoryBusy, SETUP_INSTRUCTIONS;
125022
125143
  var init_stdioServer = __esm({
125023
125144
  "wallet/src/mcp/stdioServer.mjs"() {
125024
125145
  "use strict";
@@ -125066,6 +125187,7 @@ var init_stdioServer = __esm({
125066
125187
  setupInvalid = (detail) => {
125067
125188
  throw new Error(`mcp_setup_invalid: ${detail}; the MCP server did not start and nothing was moved`);
125068
125189
  };
125190
+ TOOL_ROOTS_WAIT_MS = 6e4;
125069
125191
  ROOTS_FREE_TOOLS = /* @__PURE__ */ new Set(["x402_pay", "inference_chat", "inference_models", "x402_preview", "x402_discover"]);
125070
125192
  MCP_CLOSE_BOUND_MS = 5e3;
125071
125193
  MCP_CLOSE_HISTORY_BOUND_MS = 45e3;