shinjuku-shielded 0.3.173 → 0.3.175

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,13 +6,13 @@ 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.173. The npm packages `shinjuku-shield` and
9
+ This is version 0.3.175. 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
- npx -y shinjuku@0.3.173 setup
15
+ npx -y shinjuku@0.3.175 setup
16
16
  ```
17
17
 
18
18
  Setup offers to install the `shinjuku` command and, on Windows, adds npm's
@@ -35,13 +35,13 @@ Every wallet command works after `shinjuku`, for example `shinjuku balance`,
35
35
  Claude Code:
36
36
 
37
37
  ```sh
38
- claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.173 mcp
38
+ claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.175 mcp
39
39
  ```
40
40
 
41
41
  Claude Desktop (`claude_desktop_config.json`) or Cursor (`~/.cursor/mcp.json`):
42
42
 
43
43
  ```json
44
- { "mcpServers": { "shinjuku": { "command": "npx", "args": ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.173", "mcp"] } } }
44
+ { "mcpServers": { "shinjuku": { "command": "npx", "args": ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.175", "mcp"] } } }
45
45
  ```
46
46
 
47
47
  On native Windows, if the host cannot find `npx`, use `"command": "cmd"` and
@@ -54,7 +54,7 @@ Codex (the Codex app and Codex CLI read the same file, `~/.codex/config.toml`):
54
54
  ```toml
55
55
  [mcp_servers.shinjuku]
56
56
  command = "npx"
57
- args = ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.173", "mcp"]
57
+ args = ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.175", "mcp"]
58
58
  startup_timeout_sec = 120
59
59
  tool_timeout_sec = 300
60
60
  ```
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": "190dcbc3bb63059691cef5a801d8c249f403dff69a2e45c031da5f5edbde9f29",
5
- "bytes": 9389003,
6
- "sourceCommit": "1e7c5e1a6635c6b454956b060b7f5d6706b7e115",
4
+ "sha256": "dd3bab15896a11e725fd452abbfd4fbad9b412640201141c884a77bd6c81d5dd",
5
+ "bytes": 9395751,
6
+ "sourceCommit": "9dc2ed8abb49b3cce01ddd09f43128cc0aa5c885",
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-05T13:06:18.056Z"
1041
+ "publishedAt": "2026-11-05T23:21:41.970Z"
1042
1042
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "shinjuku-shielded",
3
- "version": "0.3.173",
3
+ "version": "0.3.175",
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": "190dcbc3",
7
- "shinjukuSha256": "190dcbc3bb63059691cef5a801d8c249f403dff69a2e45c031da5f5edbde9f29",
6
+ "shinjukuRelease": "dd3bab15",
7
+ "shinjukuSha256": "dd3bab15896a11e725fd452abbfd4fbad9b412640201141c884a77bd6c81d5dd",
8
8
  "license": "SEE LICENSE IN LICENSE.txt",
9
9
  "author": "Shinjuku Shielded",
10
10
  "homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
@@ -54246,6 +54246,7 @@ import { execFileSync as execFileSync2, spawnSync as spawnSync3 } from "node:chi
54246
54246
  import { randomBytes as randomBytes7 } from "node:crypto";
54247
54247
  import { homedir } from "node:os";
54248
54248
  import { basename as basename4, dirname as dirname6, isAbsolute as isAbsolute2, join as join9, relative as relative3, resolve as resolve6 } from "node:path";
54249
+ import { fileURLToPath as fileURLToPath4, pathToFileURL } from "node:url";
54249
54250
  function retiredPoolText(pool2, npmVersion) {
54250
54251
  const next = RETIRED_POOLS[pool2];
54251
54252
  if (!next) return void 0;
@@ -54460,6 +54461,29 @@ function mcpFlagsFromConfig(home, config) {
54460
54461
  ["--unshield-to", config.unshieldTo ? [...config.unshieldTo] : void 0]
54461
54462
  ].filter(([, value2]) => value2 !== void 0);
54462
54463
  }
54464
+ function hostEntry(target, entry, platform = process.platform) {
54465
+ const typed = ["vscode", "cline", "continue"].includes(target) ? { type: "stdio", ...entry } : entry;
54466
+ const folder = hostStartFolder(target, entry);
54467
+ if (target === "hermes" || folder === void 0) return typed;
54468
+ return { ...typed, cwd: target === "continue" && platform === "win32" ? pathToFileURL(folder).href : folder };
54469
+ }
54470
+ function hostStartFolder(target, entry) {
54471
+ const home = typeof entry?.env?.SHIELDED_WALLET_HOME === "string" ? resolve6(entry.env.SHIELDED_WALLET_HOME) : void 0;
54472
+ if (home === void 0 || !CWD_HOSTS.includes(target)) return void 0;
54473
+ return target === "hermes" || !hasPrefix(entry) ? home : void 0;
54474
+ }
54475
+ function noStartFolderWords(target, entry) {
54476
+ if (hasPrefix(entry) || hostStartFolder(target, entry) !== void 0) return "";
54477
+ return ` Your wallet folder path has a character that Windows reads as code (% & | < > ^ ! " $ or \`), so ${HOST_NAMES[target]} starts the wallet in a folder of its own: a settings file there (.npmrc) can stop the wallet. If the wallet does not start there, set up the wallet again in a folder without these characters.`;
54478
+ }
54479
+ function cwdFolder(cwd) {
54480
+ if (typeof cwd !== "string" || !cwd) return void 0;
54481
+ try {
54482
+ return resolve6(cwd.startsWith("file://") ? fileURLToPath4(cwd) : cwd);
54483
+ } catch {
54484
+ return void 0;
54485
+ }
54486
+ }
54463
54487
  function npxPackageWord(npmVersion) {
54464
54488
  const version3 = knownNpmVersion(npmVersion);
54465
54489
  return version3 ? `${NPX_PACKAGE}@${version3}` : NPX_PACKAGE;
@@ -54468,12 +54492,12 @@ function installPackageWord(npmVersion) {
54468
54492
  const version3 = knownNpmVersion(npmVersion);
54469
54493
  return version3 ? `${COMMAND_PACKAGE}@${version3}` : COMMAND_PACKAGE;
54470
54494
  }
54471
- function oneTimeCommandLine(words2, npmVersion) {
54472
- return [npxCommandPrefix(npmVersion, { recovery: RECOVERY_WORDS.test(String(words2 ?? "")) }), words2].join(" ");
54495
+ function oneTimeCommandLine(words2, npmVersion, { npmArgs = [] } = {}) {
54496
+ return [npxCommandPrefix(npmVersion, { recovery: RECOVERY_WORDS.test(String(words2 ?? "")), npmArgs }), words2].join(" ");
54473
54497
  }
54474
- function npxCommandPrefix(npmVersion, { recovery = false } = {}) {
54498
+ function npxCommandPrefix(npmVersion, { recovery = false, npmArgs = [] } = {}) {
54475
54499
  const cache = knownNpmVersion(npmVersion) && !recovery ? npxCacheFlag() : void 0;
54476
- return ["npx", ...cache ? [cache] : [], "-y", ...NPX_INSTALL_FLAGS, npxPackageWord(npmVersion)].join(" ");
54500
+ return ["npx", ...cache ? [cache] : [], "-y", ...NPX_INSTALL_FLAGS, ...npmArgs, npxPackageWord(npmVersion)].join(" ");
54477
54501
  }
54478
54502
  function npxLineFlags(text3, ownVersion) {
54479
54503
  const own = knownNpmVersion(ownVersion);
@@ -54507,12 +54531,16 @@ function terminalUseLines(npmVersion) {
54507
54531
  return ["To type shinjuku balance and the other commands in a terminal, install the shinjuku command once:", ` ${installCommandText(npmVersion)}`];
54508
54532
  }
54509
54533
  function mcpServerEntry({ home, platform = process.platform, npmVersion, path, tor } = {}) {
54510
- const npx = ["npx", "-y", ...NPX_INSTALL_FLAGS, npxPackageWord(npmVersion), "mcp"];
54534
+ const npx = ["npx", "-y", ...NPX_INSTALL_FLAGS, ...npmPrefixArgs(home, platform), npxPackageWord(npmVersion), "mcp"];
54511
54535
  return {
54512
54536
  ...platform === "win32" ? { command: "cmd", args: ["/c", ...npx] } : { command: "npx", args: npx.slice(1) },
54513
54537
  env: { SHIELDED_WALLET_HOME: resolve6(home), ...path ? { PATH: path } : {}, ...npmStartEnvironment(tor ?? homeTorOn(home)) }
54514
54538
  };
54515
54539
  }
54540
+ function npmPrefixArgs(home, platform = process.platform) {
54541
+ const folder = resolve6(home);
54542
+ return platform === "win32" && WIN_ARG_CODE.test(folder) ? [] : [`--prefix=${folder}`];
54543
+ }
54516
54544
  function homeTorOn(home) {
54517
54545
  try {
54518
54546
  return readSetupConfig(home)?.tor === true;
@@ -54548,7 +54576,11 @@ function walletEntryShape(entry, defaultHome) {
54548
54576
  delete env.SHIELDED_WALLET_HOME;
54549
54577
  delete env.PATH;
54550
54578
  for (const key of NPM_START_KEYS) delete env[key];
54551
- return { home, args, env };
54579
+ const word2 = args.findIndex(isPackageWord);
54580
+ const own = (arg, index) => index < word2 && typeof arg === "string" && arg.startsWith("--prefix=");
54581
+ if (args.some((arg, index) => own(arg, index) && resolve6(arg.slice("--prefix=".length)) !== home)) return void 0;
54582
+ if (entry.cwd !== void 0 && cwdFolder(entry.cwd) !== home) return void 0;
54583
+ return { home, args: args.filter((arg, index) => !own(arg, index)), env };
54552
54584
  }
54553
54585
  function walletEntryHomeOf(existing, entry, { defaultHome = defaultWalletHome() } = {}) {
54554
54586
  const was = walletEntryShape(existing, defaultHome);
@@ -54705,11 +54737,11 @@ function hostConfigText({ home, env = process.env, platform = process.platform,
54705
54737
  const entry = mcpServerEntry({ home, platform, npmVersion });
54706
54738
  const more = ["vscode", "devin", "cline", "continue", "gemini", "antigravity"].filter((target) => !skip.has(target)).flatMap((target) => {
54707
54739
  const file = hostConfigFile(target, { platform, env, home: userHome });
54708
- if (target === "continue") return [`${HOST_NAMES[target]}: save these lines as ${file}:`, ...continueBlockText(hostEntry(target, entry)).trimEnd().split("\n").map((line) => ` ${line}`)];
54740
+ if (target === "continue") return [`${HOST_NAMES[target]}: save these lines as ${file}:`, ...continueBlockText(hostEntry(target, entry, platform)).trimEnd().split("\n").map((line) => ` ${line}`)];
54709
54741
  const key = hostServersKey(target);
54710
54742
  return [
54711
54743
  `${HOST_NAMES[target]} (${file}): in that file, add these lines inside the { } after "${key}" (put a comma after the entry before them; a file with no "${key}" gets "${key}": { } first):`,
54712
- ...`${JSON.stringify(MCP_SERVER_NAME)}: ${JSON.stringify(hostEntry(target, entry), null, 2)}`.split("\n").map((line) => ` ${line}`)
54744
+ ...`${JSON.stringify(MCP_SERVER_NAME)}: ${JSON.stringify(hostEntry(target, entry, platform), null, 2)}`.split("\n").map((line) => ` ${line}`)
54713
54745
  ];
54714
54746
  });
54715
54747
  const member = `${JSON.stringify(MCP_SERVER_NAME)}: ${JSON.stringify(entry, null, 2)}`;
@@ -54725,11 +54757,11 @@ function hostConfigText({ home, env = process.env, platform = process.platform,
54725
54757
  ] : [],
54726
54758
  ...skip.has("codex") ? [] : [
54727
54759
  "Codex (the Codex side of the ChatGPT desktop app, and Codex CLI), at the end of ~/.codex/config.toml:",
54728
- ...codexTomlBlock(entry).trimEnd().split("\n").map((line) => ` ${line}`)
54760
+ ...codexTomlBlock(hostEntry("codex", entry, platform)).trimEnd().split("\n").map((line) => ` ${line}`)
54729
54761
  ],
54730
54762
  ...skip.has("grok") ? [] : [
54731
54763
  `Grok Build (the grok command), at the end of ${hostConfigFile("grok", { platform, env, home: userHome })}:`,
54732
- ...codexTomlBlock(entry).trimEnd().split("\n").map((line) => ` ${line}`)
54764
+ ...codexTomlBlock(hostEntry("grok", entry, platform)).trimEnd().split("\n").map((line) => ` ${line}`)
54733
54765
  ],
54734
54766
  ...skip.has("hermes") ? [] : [
54735
54767
  `Hermes Agent, at the end of ${(() => {
@@ -54787,6 +54819,7 @@ function codexTomlBlock(entry, extra = []) {
54787
54819
  `[mcp_servers.${tomlKey(MCP_SERVER_NAME)}]`,
54788
54820
  `command = ${tomlString(entry.command)}`,
54789
54821
  `args = [${entry.args.map(tomlString).join(", ")}]`,
54822
+ ...typeof entry.cwd === "string" ? [`cwd = ${tomlString(entry.cwd)}`] : [],
54790
54823
  `startup_timeout_sec = ${CODEX_STARTUP_TIMEOUT_SEC}`,
54791
54824
  `tool_timeout_sec = ${CODEX_TOOL_TIMEOUT_SEC}`,
54792
54825
  ...extra
@@ -54992,6 +55025,7 @@ function codexServersIn(text3, names) {
54992
55025
  const value2 = tomlValue(found.text);
54993
55026
  if (rel.length === 1 && rel[0] === "command") server.command = value2;
54994
55027
  else if (rel.length === 1 && rel[0] === "args") server.args = value2;
55028
+ else if (rel.length === 1 && rel[0] === "cwd") server.cwd = value2;
54995
55029
  else if (rel.length === 1 && rel[0] === "env" && isPlainObject(value2)) server.env = { ...server.env, ...value2 };
54996
55030
  else if (rel.length === 2 && rel[0] === "env") server.env[rel[1]] = value2;
54997
55031
  else if (table.length === 2 && !(rel.length === 1 && (rel[0] === "startup_timeout_sec" || rel[0] === "tool_timeout_sec"))) {
@@ -55403,6 +55437,7 @@ function addToHermesHost(file, entry, { now = /* @__PURE__ */ new Date(), force
55403
55437
  if (basename4(dirname6(dirname6(file))) === "profiles" && !existsSync(dirname6(file))) {
55404
55438
  throw new Error(`setup_host_config_unreadable: Hermes' profile folder ${dirname6(file)} does not exist, so setup wrote nothing; pick a profile with hermes profile use, then run this setup line again, or add the printed entry by hand`);
55405
55439
  }
55440
+ entry = { ...entry, ...hermesCwd(entry) ? { cwd: hermesCwd(entry) } : {} };
55406
55441
  let replaced = [];
55407
55442
  const result = changeJsonFile(file, (text3) => {
55408
55443
  const names = [MCP_SERVER_NAME, ...OLD_MCP_SERVER_NAMES];
@@ -55477,10 +55512,13 @@ function isOlderSetupEntry(existing, entry, options) {
55477
55512
  const home = walletEntryHomeOf(existing, entry, options);
55478
55513
  return home !== void 0 && home === walletEntryShape(entry, home)?.home;
55479
55514
  }
55515
+ function isPackageWord(arg) {
55516
+ return typeof arg === "string" && (PINNED_PACKAGE.test(arg) || LAUNCHER_PACKAGE.test(arg) || NPM_PACKAGE_NAMES.includes(arg) || arg === COMMAND_PACKAGE);
55517
+ }
55480
55518
  function isOlderArgs(was, now) {
55481
55519
  const pinned = (args) => args.some((arg) => PINNED_PACKAGE.test(arg));
55482
55520
  if (pinned(was) && !pinned(now)) return false;
55483
- const plain = (args) => args.map((arg) => typeof arg === "string" && (PINNED_PACKAGE.test(arg) || LAUNCHER_PACKAGE.test(arg) || NPM_PACKAGE_NAMES.includes(arg) || arg === COMMAND_PACKAGE) ? NPX_PACKAGE : arg);
55521
+ const plain = (args) => args.map((arg) => isPackageWord(arg) ? NPX_PACKAGE : arg);
55484
55522
  return sameJson(plain(was), plain(now)) || sameJson(plain(was), plain(now).filter((arg) => !NPX_INSTALL_FLAGS.includes(arg)));
55485
55523
  }
55486
55524
  function isOlderClaudeCodeEntry(existing, options = {}) {
@@ -55774,7 +55812,7 @@ function changeFileOnce(file, change, { now, platform, restrict, codec = JSON_CO
55774
55812
  }
55775
55813
  return { changed: true, ...backup ? { backup } : {} };
55776
55814
  }
55777
- var import_web396, CONFIG_SCHEMA, CONFIG_FILE, NPM_PACKAGE_NAMES, COMMAND_PACKAGE, NPX_PACKAGE, NPX_INSTALL_FLAGS, MCP_SERVER_NAME, OLD_MCP_SERVER_NAMES, P03_BINDING, PRODUCTION, RETIRED_POOLS, NO_LIMIT_ATOMIC, DEFAULT_CAPS, OLD_DEFAULT_SETUP_CAPS, OLD_DEFAULT_WALLET_BUDGETS, capText, POSITIVE_ATOMIC, HOME_FOLDER, OLDER_HOME_FOLDER, defaultHomeWords, configPath, homeWalletPath, invalid, isPubkey, MAX_OWN_ADDRESSES, isOwnAddressText, salvagePath, clearConfigSalvage, HOST_TARGETS, HOST_NAMES, hostServersKey, hostEntry, CODEX_STARTUP_TIMEOUT_SEC, CODEX_TOOL_TIMEOUT_SEC, PINNED_PACKAGE, LAUNCHER_PACKAGE, NPM_VERSION, knownNpmVersion, RECOVERY_WORDS, NPX_WALLET_LINE, RELEASES_URL, npmStartEnvironment, NPM_START_KEYS, defaultWalletHome, CMD_UNSAFE, programOf, claudeLineDiffers, WINDOWS_SHELL_CODE, CLAUDE_DESKTOP_FILE, claudeDataDirsCache, CONTINUE_HEADER, tomlString, tomlKey, codexEntryOf, HERMES_TRUST, HERMES_TOOL_TIMEOUT_SEC, hermesCwd, HERMES_OWN_KEYS, HERMES_RESERVED_PROFILES, yamlString, hermesEntryOf, isPlainObject, sameJson, claudeCodeEntry, READ_ONLY_TOOL_NAMES, claudeCodeAllowRules, claudeCodeSettingsFile, UNREADABLE_JSON, JSON_CODEC, indentAt, TEXT_CODEC, RACED;
55815
+ var import_web396, CONFIG_SCHEMA, CONFIG_FILE, NPM_PACKAGE_NAMES, COMMAND_PACKAGE, NPX_PACKAGE, NPX_INSTALL_FLAGS, MCP_SERVER_NAME, OLD_MCP_SERVER_NAMES, P03_BINDING, PRODUCTION, RETIRED_POOLS, NO_LIMIT_ATOMIC, DEFAULT_CAPS, OLD_DEFAULT_SETUP_CAPS, OLD_DEFAULT_WALLET_BUDGETS, capText, POSITIVE_ATOMIC, HOME_FOLDER, OLDER_HOME_FOLDER, defaultHomeWords, configPath, homeWalletPath, invalid, isPubkey, MAX_OWN_ADDRESSES, isOwnAddressText, salvagePath, clearConfigSalvage, HOST_TARGETS, HOST_NAMES, hostServersKey, CWD_HOSTS, hasPrefix, CODEX_STARTUP_TIMEOUT_SEC, CODEX_TOOL_TIMEOUT_SEC, PINNED_PACKAGE, LAUNCHER_PACKAGE, NPM_VERSION, knownNpmVersion, RECOVERY_WORDS, NPX_WALLET_LINE, RELEASES_URL, npmStartEnvironment, WIN_ARG_CODE, NPM_START_KEYS, defaultWalletHome, CMD_UNSAFE, programOf, claudeLineDiffers, WINDOWS_SHELL_CODE, CLAUDE_DESKTOP_FILE, claudeDataDirsCache, CONTINUE_HEADER, tomlString, tomlKey, codexEntryOf, HERMES_TRUST, HERMES_TOOL_TIMEOUT_SEC, hermesCwd, HERMES_OWN_KEYS, HERMES_RESERVED_PROFILES, yamlString, hermesEntryOf, isPlainObject, sameJson, claudeCodeEntry, READ_ONLY_TOOL_NAMES, claudeCodeAllowRules, claudeCodeSettingsFile, UNREADABLE_JSON, JSON_CODEC, indentAt, TEXT_CODEC, RACED;
55778
55816
  var init_config = __esm({
55779
55817
  "wallet/src/setup/config.mjs"() {
55780
55818
  "use strict";
@@ -55851,7 +55889,8 @@ var init_config = __esm({
55851
55889
  hermes: "Hermes Agent"
55852
55890
  });
55853
55891
  hostServersKey = (target) => target === "vscode" ? "servers" : "mcpServers";
55854
- hostEntry = (target, entry) => ["vscode", "cline", "continue"].includes(target) ? { type: "stdio", ...entry } : entry;
55892
+ CWD_HOSTS = Object.freeze(["vscode", "codex", "grok", "gemini", "cline", "continue", "hermes"]);
55893
+ hasPrefix = (entry) => Array.isArray(entry?.args) && entry.args.some((arg) => typeof arg === "string" && arg.startsWith("--prefix="));
55855
55894
  CODEX_STARTUP_TIMEOUT_SEC = 120;
55856
55895
  CODEX_TOOL_TIMEOUT_SEC = 300;
55857
55896
  PINNED_PACKAGE = /^shinjuku(?:-shield(?:ed)?)?@(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/;
@@ -55862,6 +55901,7 @@ var init_config = __esm({
55862
55901
  NPX_WALLET_LINE = /npx (?:--(?:prefer-)?offline )?-y ((?:--no-audit --no-fund )?(?:shinjuku-shield|shinjuku)@(\d+\.\d+\.\d+))((?: (?:setup|restore))(?=\s|$|[^\w-]))?/g;
55863
55902
  RELEASES_URL = "https://github.com/ShinjukuStaition/shinjuku-shield#releases";
55864
55903
  npmStartEnvironment = (tor) => tor ? { npm_config_offline: "true" } : { npm_config_prefer_offline: "true" };
55904
+ WIN_ARG_CODE = /[%&|<>^!"$`\r\n]/;
55865
55905
  NPM_START_KEYS = ["npm_config_offline", "npm_config_prefer_offline"];
55866
55906
  defaultWalletHome = (home = homedir()) => setupHome({}, home);
55867
55907
  CMD_UNSAFE = /[%"\r\n]/;
@@ -55875,6 +55915,7 @@ var init_config = __esm({
55875
55915
  codexEntryOf = (server) => ({
55876
55916
  command: server.command,
55877
55917
  args: server.args,
55918
+ ...server.cwd !== void 0 ? { cwd: server.cwd } : {},
55878
55919
  ...isPlainObject(server.env) && Object.keys(server.env).length ? { env: server.env } : {}
55879
55920
  });
55880
55921
  HERMES_TRUST = "untrusted";
@@ -55886,6 +55927,7 @@ var init_config = __esm({
55886
55927
  hermesEntryOf = (server) => ({
55887
55928
  command: server.command,
55888
55929
  args: server.args,
55930
+ ...server.cwd != null ? { cwd: server.cwd } : {},
55889
55931
  ...isPlainObject(server.env) && Object.keys(server.env).length ? { env: server.env } : {}
55890
55932
  });
55891
55933
  isPlainObject = (value2) => Boolean(value2) && typeof value2 === "object" && !Array.isArray(value2);
@@ -65146,7 +65188,7 @@ var init_witness = __esm({
65146
65188
  });
65147
65189
 
65148
65190
  // wallet/src/deposit/deposit.mjs
65149
- import { fileURLToPath as fileURLToPath4 } from "node:url";
65191
+ import { fileURLToPath as fileURLToPath5 } from "node:url";
65150
65192
  function relayOwnerKeypair(store, relay) {
65151
65193
  if (relay.own === true) return import_web3102.Keypair.fromSecretKey(Uint8Array.from(store.state.solanaSecretKey));
65152
65194
  if (relay.pocket === void 0) return depositKeypair(store.state, relay.index, relay.keyPool ?? store.state.pool);
@@ -65158,7 +65200,7 @@ function fail12(reason) {
65158
65200
  }
65159
65201
  function pinnedGenerator() {
65160
65202
  const url = new URL("../../vendor/shielded-x402-model/vectors/rust-vectors.json", new URL("__bundled_source__/wallet/src/deposit/deposit.mjs", import.meta.url).href);
65161
- return JSON.parse(readFileSync(fileURLToPath4(url), "utf8")).payerKeys.generator;
65203
+ return JSON.parse(readFileSync(fileURLToPath5(url), "utf8")).payerKeys.generator;
65162
65204
  }
65163
65205
  function assertDepositId(depositId) {
65164
65206
  if (!/^[0-9a-zA-Z_-]{1,64}$/.test(depositId ?? "")) fail12("id_invalid");
@@ -67428,7 +67470,7 @@ var init_successorHistories = __esm({
67428
67470
  import { createHash as createHash16 } from "node:crypto";
67429
67471
  import { join as join14, resolve as resolve11 } from "node:path";
67430
67472
  import { performance as performance4 } from "node:perf_hooks";
67431
- import { fileURLToPath as fileURLToPath5 } from "node:url";
67473
+ import { fileURLToPath as fileURLToPath6 } from "node:url";
67432
67474
  function pinnedGenerator2(profileVector) {
67433
67475
  if (profileVector?.payerKeys?.generator) return profileVector.payerKeys.generator;
67434
67476
  if (!committedGenerator) {
@@ -68007,7 +68049,7 @@ var init_recover = __esm({
68007
68049
  init_successorHistories();
68008
68050
  FIELD_MODULUS6 = BigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617");
68009
68051
  MODEL_DIR = resolve11(
68010
- fileURLToPath5(new URL("../../vendor/shielded-x402-model/", new URL("__bundled_source__/wallet/src/recovery/recover.mjs", import.meta.url).href))
68052
+ fileURLToPath6(new URL("../../vendor/shielded-x402-model/", new URL("__bundled_source__/wallet/src/recovery/recover.mjs", import.meta.url).href))
68011
68053
  );
68012
68054
  seedBytes3 = (state2) => Uint8Array.from(Buffer.from(state2.seedHex, "hex"));
68013
68055
  REPLAY_VALUES = /* @__PURE__ */ new Map();
@@ -76000,7 +76042,7 @@ var init_solana_ed255192 = __esm({
76000
76042
  // spikes/shielded-x402-solana/scripts/verify-production-parameter-bundle.mjs
76001
76043
  import { createHash as createHash17 } from "node:crypto";
76002
76044
  import { dirname as dirname13, isAbsolute as isAbsolute5, relative as relative6, resolve as resolve12 } from "node:path";
76003
- import { fileURLToPath as fileURLToPath6 } from "node:url";
76045
+ import { fileURLToPath as fileURLToPath7 } from "node:url";
76004
76046
  function fail14(message) {
76005
76047
  throw new Error(`production parameter bundle rejected: ${message}`);
76006
76048
  }
@@ -76382,7 +76424,7 @@ var init_verify_production_parameter_bundle2 = __esm({
76382
76424
  FAWKES_VERSION2 = "4.7.0";
76383
76425
  FAWKES_CHECKSUM2 = "3f221a5c9ba1e17e60bbbf87022f317b02c41218024ae20ac4ab19eca74ea2a5";
76384
76426
  FIELD_BYTES5 = 32;
76385
- isMain = process.argv[1] && resolve12(process.argv[1]) === resolve12(fileURLToPath6(new URL("__bundled_source__/spikes/shielded-x402-solana/scripts/verify-production-parameter-bundle.mjs", import.meta.url).href));
76427
+ isMain = process.argv[1] && resolve12(process.argv[1]) === resolve12(fileURLToPath7(new URL("__bundled_source__/spikes/shielded-x402-solana/scripts/verify-production-parameter-bundle.mjs", import.meta.url).href));
76386
76428
  if (isMain) {
76387
76429
  const args = parseArgs(process.argv.slice(2));
76388
76430
  if (!args.bundle) fail14("--bundle is required");
@@ -76878,7 +76920,7 @@ var init_p03_recovered_exit = __esm({
76878
76920
  // spikes/shielded-x402-wallet/bin/shielded-wallet.mjs
76879
76921
  import { createHash as createHash19 } from "node:crypto";
76880
76922
  import { join as join16, resolve as resolve15 } from "node:path";
76881
- import { fileURLToPath as fileURLToPath7 } from "node:url";
76923
+ import { fileURLToPath as fileURLToPath8 } from "node:url";
76882
76924
  function walletHome() {
76883
76925
  return setupHome(process.env);
76884
76926
  }
@@ -78885,7 +78927,7 @@ var init_shielded_wallet = __esm({
78885
78927
  MAINNET_CONFIRMATION = "I_UNDERSTAND_MAINNET_USDC_SPEND";
78886
78928
  FIELD_MODULUS7 = BigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617");
78887
78929
  MODEL_DIR2 = resolve15(
78888
- fileURLToPath7(new URL("../../shielded-x402-model/", new URL("__bundled_source__/spikes/shielded-x402-wallet/bin/shielded-wallet.mjs", import.meta.url).href))
78930
+ fileURLToPath8(new URL("../../shielded-x402-model/", new URL("__bundled_source__/spikes/shielded-x402-wallet/bin/shielded-wallet.mjs", import.meta.url).href))
78889
78931
  );
78890
78932
  WALLET_SCHEMA = "carbon-shielded-wallet/state/v1";
78891
78933
  passphrase = () => {
@@ -78927,7 +78969,7 @@ var init_shielded_wallet = __esm({
78927
78969
  return value2;
78928
78970
  };
78929
78971
  BROADCASTER_KEY_FILE_INVALID = "broadcaster_key_file_invalid: --broadcaster-key-file must be a solana-keygen JSON keypair file (a JSON array of 64 byte values)";
78930
- invokedDirectly = process.argv[1] && fileURLToPath7(new URL("__bundled_source__/spikes/shielded-x402-wallet/bin/shielded-wallet.mjs", import.meta.url).href) === resolve15(process.argv[1]);
78972
+ invokedDirectly = process.argv[1] && fileURLToPath8(new URL("__bundled_source__/spikes/shielded-x402-wallet/bin/shielded-wallet.mjs", import.meta.url).href) === resolve15(process.argv[1]);
78931
78973
  if (invokedDirectly) {
78932
78974
  main().catch((error) => {
78933
78975
  printFailure(error);
@@ -104755,7 +104797,7 @@ var init_balance = __esm({
104755
104797
  // wallet/src/pay/floatPay.mjs
104756
104798
  import { createHash as createHash26, createHmac as createHmac8, randomBytes as randomBytes16, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
104757
104799
  import { dirname as dirname21, join as join20 } from "node:path";
104758
- import { fileURLToPath as fileURLToPath8 } from "node:url";
104800
+ import { fileURLToPath as fileURLToPath9 } from "node:url";
104759
104801
  function refundEtaLeft(dueAtMs, now = Date.now()) {
104760
104802
  if (!Number.isSafeInteger(dueAtMs) || now > dueAtMs + 6e4) return void 0;
104761
104803
  return Math.max(60, Math.ceil((dueAtMs - now) / 1e3));
@@ -106714,7 +106756,7 @@ var init_floatPay = __esm({
106714
106756
  poolDomainReads = /* @__PURE__ */ new Map();
106715
106757
  poolDomainWarmFailedAt = /* @__PURE__ */ new Map();
106716
106758
  WARM_RETRY_MS = 3e4;
106717
- loadPayerGenerator = () => payerGenerator ??= JSON.parse(readFileSync(fileURLToPath8(new URL(
106759
+ loadPayerGenerator = () => payerGenerator ??= JSON.parse(readFileSync(fileURLToPath9(new URL(
106718
106760
  "../../vendor/shielded-x402-model/vectors/rust-vectors.json",
106719
106761
  new URL("__bundled_source__/wallet/src/pay/floatPay.mjs", import.meta.url).href
106720
106762
  )), "utf8")).payerKeys.generator;
@@ -106762,13 +106804,13 @@ var init_floatPay = __esm({
106762
106804
  // wallet/src/unshield/selfPay.mjs
106763
106805
  import { randomBytes as randomBytes17 } from "node:crypto";
106764
106806
  import { join as join21 } from "node:path";
106765
- import { fileURLToPath as fileURLToPath9 } from "node:url";
106807
+ import { fileURLToPath as fileURLToPath10 } from "node:url";
106766
106808
  function fail22(reason) {
106767
106809
  throw new Error(`p03_self_pay_${reason}`);
106768
106810
  }
106769
106811
  function pinnedGenerator4() {
106770
106812
  const url = new URL("../../vendor/shielded-x402-model/vectors/rust-vectors.json", new URL("__bundled_source__/wallet/src/unshield/selfPay.mjs", import.meta.url).href);
106771
- return generator ??= Object.freeze(JSON.parse(readFileSync(fileURLToPath9(url), "utf8")).payerKeys.generator);
106813
+ return generator ??= Object.freeze(JSON.parse(readFileSync(fileURLToPath10(url), "utf8")).payerKeys.generator);
106772
106814
  }
106773
106815
  function abandonedMergeUnsent(store, id) {
106774
106816
  if (!MERGE_ID.test(id) || store.readWal(`self-pay-${id}`)?.state !== "abandoned") return false;
@@ -107390,7 +107432,7 @@ var init_privateSend = __esm({
107390
107432
 
107391
107433
  // wallet/src/pay/prepareRecoveredPayment.mjs
107392
107434
  import { join as join22, resolve as resolve17 } from "node:path";
107393
- import { fileURLToPath as fileURLToPath10 } from "node:url";
107435
+ import { fileURLToPath as fileURLToPath11 } from "node:url";
107394
107436
  function fail24(reason) {
107395
107437
  throw new Error(`p03_merchant_respend_${reason}`);
107396
107438
  }
@@ -108157,7 +108199,7 @@ var init_prepareRecoveredPayment = __esm({
108157
108199
  init_accountSelection();
108158
108200
  init_phaseTiming();
108159
108201
  init_privateSend();
108160
- MODEL_DIR3 = resolve17(fileURLToPath10(new URL("../../vendor/shielded-x402-model/", new URL("__bundled_source__/wallet/src/pay/prepareRecoveredPayment.mjs", import.meta.url).href)));
108202
+ MODEL_DIR3 = resolve17(fileURLToPath11(new URL("../../vendor/shielded-x402-model/", new URL("__bundled_source__/wallet/src/pay/prepareRecoveredPayment.mjs", import.meta.url).href)));
108161
108203
  seedBytes5 = (state2) => Uint8Array.from(Buffer.from(state2.seedHex, "hex"));
108162
108204
  EARLY_CHAIN_TIME_MAX_AGE_MS = 3e4;
108163
108205
  settledNoteExits = /* @__PURE__ */ new Map();
@@ -108510,7 +108552,7 @@ var init_anchorWait = __esm({
108510
108552
 
108511
108553
  // wallet/src/pay/payResource.mjs
108512
108554
  import { join as join24, resolve as resolvePath } from "node:path";
108513
- import { fileURLToPath as fileURLToPath11 } from "node:url";
108555
+ import { fileURLToPath as fileURLToPath12 } from "node:url";
108514
108556
  function assertOwnerUnshieldRequest(requestId, url) {
108515
108557
  const id = OWNER_UNSHIELD_REQUEST.exec(requestId)?.[1];
108516
108558
  if (!id || url !== `${OWNER_UNSHIELD_ORIGIN}/unshield/${id}`) fail25("owner_unshield_not_self_pay");
@@ -108542,7 +108584,7 @@ function recordedKind(record) {
108542
108584
  return void 0;
108543
108585
  }
108544
108586
  function assertOwnerUnshieldPayee(store, requirement) {
108545
- const generator2 = JSON.parse(readFileSync(fileURLToPath11(new URL(
108587
+ const generator2 = JSON.parse(readFileSync(fileURLToPath12(new URL(
108546
108588
  "../../vendor/shielded-x402-model/vectors/rust-vectors.json",
108547
108589
  new URL("__bundled_source__/wallet/src/pay/payResource.mjs", import.meta.url).href
108548
108590
  )), "utf8")).payerKeys.generator;
@@ -115783,7 +115825,7 @@ var init_floatRefundCheck = __esm({
115783
115825
  // wallet/src/unshield/cli.mjs
115784
115826
  import { randomBytes as randomBytes20 } from "node:crypto";
115785
115827
  import { resolve as resolve20 } from "node:path";
115786
- import { fileURLToPath as fileURLToPath12 } from "node:url";
115828
+ import { fileURLToPath as fileURLToPath13 } from "node:url";
115787
115829
  function facilitatorAnchor(origin, fetchImpl = fetch, { sleep: sleep5 = (ms) => new Promise((resolve43) => setTimeout(resolve43, ms)) } = {}) {
115788
115830
  noteAnchorOrigin(origin);
115789
115831
  const url = `${String(origin).replace(/\/+$/, "")}/api/x402/anchor`;
@@ -116287,7 +116329,7 @@ var init_cli = __esm({
116287
116329
  EXPIRED_PROOF_CLOCK_WAITS = 8;
116288
116330
  EXPIRED_PROOF_CLOCK_WAIT_MS = 15e3;
116289
116331
  EXIT_LEASE_WAIT_MS = 6e4;
116290
- if (process.argv[1] && resolve20(process.argv[1]) === fileURLToPath12(new URL("__bundled_source__/wallet/src/unshield/cli.mjs", import.meta.url).href)) {
116332
+ if (process.argv[1] && resolve20(process.argv[1]) === fileURLToPath13(new URL("__bundled_source__/wallet/src/unshield/cli.mjs", import.meta.url).href)) {
116291
116333
  main2().catch((error) => {
116292
116334
  console.error(describeCliErrorWithHint(error));
116293
116335
  process.exitCode = 1;
@@ -117017,7 +117059,7 @@ var init_migration = __esm({
117017
117059
 
117018
117060
  // wallet/src/pocket/cli.mjs
117019
117061
  import { resolve as resolve21 } from "node:path";
117020
- import { fileURLToPath as fileURLToPath13 } from "node:url";
117062
+ import { fileURLToPath as fileURLToPath14 } from "node:url";
117021
117063
  function parse3(command, args) {
117022
117064
  const spec = SPECS[command];
117023
117065
  const options = {};
@@ -117502,7 +117544,7 @@ var init_cli2 = __esm({
117502
117544
  } catch {
117503
117545
  }
117504
117546
  };
117505
- if (process.argv[1] && resolve21(process.argv[1]) === fileURLToPath13(new URL("__bundled_source__/wallet/src/pocket/cli.mjs", import.meta.url).href)) {
117547
+ if (process.argv[1] && resolve21(process.argv[1]) === fileURLToPath14(new URL("__bundled_source__/wallet/src/pocket/cli.mjs", import.meta.url).href)) {
117506
117548
  main3().catch((error) => {
117507
117549
  console.error(describeCliErrorWithHint(error, { fallback: "p03_pocket_cli_failed" }));
117508
117550
  process.exitCode = 1;
@@ -117836,7 +117878,7 @@ var init_autoPockets = __esm({
117836
117878
  });
117837
117879
 
117838
117880
  // wallet/src/move/job.mjs
117839
- import { fileURLToPath as fileURLToPath14 } from "node:url";
117881
+ import { fileURLToPath as fileURLToPath15 } from "node:url";
117840
117882
  import { randomBytes as randomBytes21 } from "node:crypto";
117841
117883
  function moveLegs(store, fromPool) {
117842
117884
  const prefix = moveWalPrefix(fromPool);
@@ -117951,7 +117993,7 @@ function moveBody({ amountAtomic, refundTo, fromPool, n, toPool }) {
117951
117993
  return { bodyText, moveId: hash10(bodyText) };
117952
117994
  }
117953
117995
  function walletEta2(store) {
117954
- const generator2 = JSON.parse(readFileSync(fileURLToPath14(new URL(
117996
+ const generator2 = JSON.parse(readFileSync(fileURLToPath15(new URL(
117955
117997
  "../../vendor/shielded-x402-model/vectors/rust-vectors.json",
117956
117998
  new URL("__bundled_source__/wallet/src/move/job.mjs", import.meta.url).href
117957
117999
  )), "utf8")).payerKeys.generator;
@@ -120408,7 +120450,7 @@ var init_leg = __esm({
120408
120450
  // wallet/src/succession/scheduler.mjs
120409
120451
  import { randomInt as cryptoRandomInt } from "node:crypto";
120410
120452
  import { dirname as dirname26, resolve as resolve23 } from "node:path";
120411
- import { fileURLToPath as fileURLToPath15 } from "node:url";
120453
+ import { fileURLToPath as fileURLToPath16 } from "node:url";
120412
120454
  function pocketCarryReason(carry) {
120413
120455
  if (carry && CARRY_DONE.has(carry.state)) return { done: true, waits: false, code: null, reason: "" };
120414
120456
  if (carry?.state !== "refused") return { done: false, waits: true, code: null, reason: "the wallet has not finished its check of the pool switch" };
@@ -121293,7 +121335,7 @@ var init_scheduler = __esm({
121293
121335
  const record = store.readWal(successionNoticeName(fromPool));
121294
121336
  return record?.schema === SUCCESSION_NOTICE_SCHEMA && record.from === fromPool && record.shown && typeof record.shown === "object" ? record.shown : {};
121295
121337
  };
121296
- MODEL_VECTORS = fileURLToPath15(new URL("../../vendor/shielded-x402-model/vectors/rust-vectors.json", new URL("__bundled_source__/wallet/src/succession/scheduler.mjs", import.meta.url).href));
121338
+ MODEL_VECTORS = fileURLToPath16(new URL("../../vendor/shielded-x402-model/vectors/rust-vectors.json", new URL("__bundled_source__/wallet/src/succession/scheduler.mjs", import.meta.url).href));
121297
121339
  pinnedGenerator6 = () => JSON.parse(readFileSync(MODEL_VECTORS, "utf8")).payerKeys.generator;
121298
121340
  yieldTurn3 = () => new Promise((resolveTurn) => {
121299
121341
  setImmediate(resolveTurn);
@@ -131792,7 +131834,7 @@ var init_jupiter = __esm({
131792
131834
  // wallet/src/mcp/tools.mjs
131793
131835
  import { randomBytes as randomBytes26, randomInt as randomInt7 } from "node:crypto";
131794
131836
  import { basename as basename9, dirname as dirname30, join as join34, resolve as resolve27 } from "node:path";
131795
- import { fileURLToPath as fileURLToPath16 } from "node:url";
131837
+ import { fileURLToPath as fileURLToPath17 } from "node:url";
131796
131838
  async function readReleasePoolsTwice(args) {
131797
131839
  try {
131798
131840
  return await readReleasePools(args);
@@ -133101,7 +133143,7 @@ function capHeldAtomic(one) {
133101
133143
  return parts.reduce((total, part) => total + BigInt(part), 0n);
133102
133144
  }
133103
133145
  function walletViewingEta(store) {
133104
- receiveGenerator ??= JSON.parse(readFileSync(fileURLToPath16(new URL(
133146
+ receiveGenerator ??= JSON.parse(readFileSync(fileURLToPath17(new URL(
133105
133147
  "../../vendor/shielded-x402-model/vectors/rust-vectors.json",
133106
133148
  new URL("__bundled_source__/wallet/src/mcp/tools.mjs", import.meta.url).href
133107
133149
  )), "utf8")).payerKeys.generator;
@@ -135080,7 +135122,8 @@ ${canonical5}`;
135080
135122
  return said;
135081
135123
  }
135082
135124
  if (typeof parsed2.next !== "string") return said;
135083
- parsed2.next = `${parsed2.next.replace(/[.\s]+$/, "")}. ${nextNote}`;
135125
+ const note = typeof nextNote === "function" ? nextNote(parsed2) : nextNote;
135126
+ parsed2.next = `${parsed2.next.replace(/[.\s]+$/, "")}. ${note}`;
135084
135127
  const out = JSON.stringify(parsed2, null, /^\s*\{\s*\n/.test(text3) ? 2 : void 0);
135085
135128
  return { ...said, text: out, ...blocks ? { content: [{ ...blocks[0], text: out }, ...blocks.slice(1)] } : {} };
135086
135129
  }
@@ -137971,7 +138014,7 @@ ${canonical5}`;
137971
138014
  const sendStoppedFailure = (job) => ({
137972
138015
  code: SEND_STOPPED,
137973
138016
  detail: `the app stopped the call before the send of ${usdcText3(job.amountAtomic)} USDC was signed, so the wallet stopped it; nothing was sent`,
137974
- next: "Nothing was sent. Tell the user the send was stopped and nothing left the private balance. Send it only if the user asks again: then call wallet_unshield with a NEW request_id (it asks the user again)",
138017
+ next: "Nothing was sent. Tell the user the send was stopped and nothing left the private balance. Send it only if the user asks again: then call wallet_unshield with a NEW request_id (it asks the user again, except for an address the user saved, which sends at once)",
137975
138018
  say: `Nothing was sent: the send of ${usdcText3(job.amountAtomic)} USDC was stopped before it was signed.`
137976
138019
  });
137977
138020
  function jobFailure(kind, job, error, linkHeld = /* @__PURE__ */ new Map()) {
@@ -138755,16 +138798,30 @@ ${canonical5}`;
138755
138798
  return { ok: false, why: error?.timedOut === true ? `no answer in ${Math.round(elicitTimeoutMs / 1e3)} s` : "this app did not answer the confirmation" };
138756
138799
  }
138757
138800
  }
138758
- function intentDoneAtMs(kind) {
138801
+ function intentDoneAtMs(kind, stopped = {}) {
138802
+ const released = () => {
138803
+ stopped.seen = true;
138804
+ return stopped.release === true ? 0 : void 0;
138805
+ };
138759
138806
  return (requestId, store) => {
138760
138807
  const job = jobs.get(`${kind}:${toRecordId(requestId)}`);
138761
138808
  if (job?.state === "done") return job.doneAtMs;
138809
+ if (kind === "unshield" && job?.state === "failed" && job.error?.code === SEND_STOPPED) return released();
138762
138810
  if (job?.state === "failed") return /NEW request_id|Do not retry this request/.test(String(job.error?.next ?? "")) ? 0 : void 0;
138763
138811
  if (job) return void 0;
138764
138812
  const names = kind === "unshield" ? [`self-pay-${moneyId(requestId)}`, privateSendPlanName(moneyId(requestId))] : [KINDS[kind].walName(requestId)];
138765
138813
  for (const name of names) {
138766
138814
  const record = store.readWal(name);
138767
138815
  if (!record) continue;
138816
+ if (kind === "unshield" && name === names[0] && record.schema === SELF_PAY_WAL_SCHEMA && record.state === "started" && record.refusedCode === SEND_STOPPED) {
138817
+ let signed = true;
138818
+ try {
138819
+ signed = selfPayMayHaveSigned(store, moneyId(requestId));
138820
+ } catch {
138821
+ signed = true;
138822
+ }
138823
+ return signed ? void 0 : released();
138824
+ }
138768
138825
  const finished = kind !== "unshield" ? ["published", "foreign_funded", "reclaimed"].includes(record.state) : record.schema === PRIVATE_SEND_WAL_SCHEMA ? record.state === "done" || record.state === "cancelled" && privateSendStatus(store, record).done : ["exited", "released", "abandoned"].includes(record.state);
138769
138826
  if (!finished) return void 0;
138770
138827
  const at = Date.parse(String(record.doneAt ?? "")) || sentAtMs(record);
@@ -138809,13 +138866,30 @@ ${canonical5}`;
138809
138866
  }
138810
138867
  return void 0;
138811
138868
  }
138869
+ const CLAIM_LEASE_WAIT_MS = 8e3;
138870
+ async function claimUnderLease(task) {
138871
+ const until = Date.now() + CLAIM_LEASE_WAIT_MS;
138872
+ for (; ; ) {
138873
+ try {
138874
+ return await underLease(task);
138875
+ } catch (error) {
138876
+ if (!/wallet_process_locked|wallet_locked/.test(String(error?.message ?? error)) || Date.now() >= until) throw error;
138877
+ await new Promise((resolve43) => {
138878
+ const timer = setTimeout(resolve43, 250);
138879
+ timer.unref?.();
138880
+ });
138881
+ }
138882
+ }
138883
+ }
138812
138884
  async function beginWithoutId(kind, args, options) {
138813
138885
  const spec = KINDS[kind];
138814
138886
  const probe = argumentsOf(kind, { ...args, request_id: "intent-probe" }, { probe: true });
138815
138887
  if (probe.refusal) return refuse12(...probe.refusal);
138816
138888
  let claimed;
138889
+ const stopped = {};
138817
138890
  try {
138818
- claimed = intents.claim(kind, probe, INTENT_WINDOW_MS, intentDoneAtMs(kind));
138891
+ const found = intents.find(kind, probe, INTENT_WINDOW_MS, intentDoneAtMs(kind, stopped));
138892
+ if (found && !stopped.seen) claimed = { ...found, created: false };
138819
138893
  } catch (error) {
138820
138894
  return refuse12(
138821
138895
  "mcp_wallet_unreadable",
@@ -138823,13 +138897,21 @@ ${canonical5}`;
138823
138897
  `call ${spec.tool} again, or pass your own request_id`
138824
138898
  );
138825
138899
  }
138900
+ if (!claimed) {
138901
+ try {
138902
+ claimed = await claimUnderLease(() => intents.claim(kind, probe, INTENT_WINDOW_MS, intentDoneAtMs(kind, { release: true })));
138903
+ } catch (error) {
138904
+ return /^(?:wallet_locked|wallet_process_locked)$/.test(errorCode2(error, "wallet_locked")) ? refuse12(
138905
+ "wallet_locked",
138906
+ "another program is using this wallet right now, so this call did not start anything; another app may be running the same request",
138907
+ `This call did not start a ${spec.noun}. Do not tell the user whether money moved: first call ${spec.tool === "wallet_unshield" ? "wallet_cancel with no request_id, or wallet_receipts" : "wallet_receipts"}, or call ${spec.tool} again with the same arguments in about a minute (it reads the same request and never moves money twice). If it repeats, tell the user another program (for example a Shinjuku terminal window) is using the wallet`,
138908
+ { done: false, say: "The wallet is busy with another program right now, so this request did not start here. I will check and try again.", ...lockedFields() }
138909
+ ) : refuse12("mcp_wallet_unreadable", describeError(error, { fallback: "wallet_store_unreadable" }), `call ${spec.tool} again, or pass your own request_id`);
138910
+ }
138911
+ }
138826
138912
  if (claimed.created) log(`MCP_INTENT_NEW kind=${kind} requestId=${claimed.requestId}`);
138827
138913
  const answer = await begin(kind, { ...args, request_id: claimed.requestId }, options);
138828
- return withAutoId(
138829
- answer,
138830
- spec.tool,
138831
- "The same call without request_id within 10 minutes after it ends reads this same request; if the user wants to do it again later, ask after 10 minutes or give a new request_id."
138832
- );
138914
+ return withAutoId(answer, spec.tool, (parsed2) => kind === "unshield" && parsed2.error === SEND_STOPPED ? "The same call without request_id reads this stopped send again; to send it, the user must ask again and you pass a NEW request_id." : "The same call without request_id within 10 minutes after it ends reads this same request; if the user wants to do it again later, ask after 10 minutes or give a new request_id.");
138833
138915
  }
138834
138916
  function stageChanged(job) {
138835
138917
  if (!job.changed) {
@@ -140514,7 +140596,7 @@ ${canonical5}`;
140514
140596
  name: "wallet_unshield",
140515
140597
  // UX130-13: a host that defers tools may show only the title: it says where a send goes by default.
140516
140598
  title: "Send USDC privately",
140517
- description: `Use this when the user says "send 2 USDC to <address>" or "withdraw to my wallet" (for "my wallet" leave \`to\` out: it uses the address saved at setup, or says how to set one; never ask the user first): it sends amount (USDC, like "2"; or amount_atomic) from the PRIVATE balance as plain USDC to \`to\`, a public Solana address. BEFORE you call it to send all of the balance when wallet_balance showed balanceParts above 1, write to the user that the wallet first gets the balance ready to send (do not tell the user how the wallet stores the balance; some apps show nothing until this call ends). Privately: the chain shows the pool paying the address, not which wallet paid. The wallet's own key (ownAddress in wallet_balance) is this wallet's public address: it holds the public USDC, wallet_shield deposits from it, and wallet_transfer_token sells from it. So it is refused as \`to\`: an exit there would show on chain that the private balance belongs to this wallet. This holds whether or not that key ever deposited: wallet_add_funds deposits come from one-time addresses, not from this key, so never tell the user the deposits came from it. Shinjuku pays every network fee; no SOL is needed. The user's saved own addresses (setup or this app's wallet entry) send at once. Any other address is sent only after the user confirms it in this app (a confirmation dialog); a client that cannot ask is refused (mcp_unshield_to_not_allowed) and a decline sends nothing (mcp_unshield_declined). \`to\` must already be able to receive USDC: an address that cannot is refused before any dialog (mcp_unshield_to_invalid). It runs in steps and may wait for the pool's next anchor: the call answers within about 20 s with stage (confirming, queued, refreshing, self-pay = preparing, exit = sending, done; joining = the wallet first gets the balance ready to send, then sends; each call goes on with it (joinSteps: its steps, one after another; doneInMinutesLow to doneInMinutesHigh: the time to say), ok: true); call wallet_unshield again with the SAME request_id, amount, and to for the status (each call answers within about 20 s, at once when the send ends; a confirmation dialog the user answers may take longer). When the wallet must first get the balance ready to send, the FIRST call answers at once with stage joining and joinTellFirst: true; write its say to the user, then call again with the same request_id at once. One exception: for a send whose balance must first be made ready, when this app sends a progress token with the call, that next call gets the balance ready and then sends, with a progress line every ${JOIN_STEP_MS / 1e3} s ("getting your balance ready to send"; some apps show none of them, so the line is said before the call, as above). It answers when the send is done, or after about ${joinAnswerSeconds(JOIN_CALL_MAX_MS)} s with how far it got (joinsDone; sendState sending: the USDC is leaving, never say nothing moved); then call again with the same request_id. Without a progress token it answers within about 20 s with stage joining: call again until it sends. The same request_id never sends twice, also after a restart. request_id is optional: without it the answer names the id it made, and the same call again within 10 minutes after it ends reads that same send. An optional limit the user sets (the unshield limit) may bound each call and what this wallet sends in any 24 hours, from every app that runs it (mcp_unshield_cap_exceeded: tell the user). Other refusals: mcp_argument_invalid, mcp_request_id_reused, wallet_locked, mcp_tool_disabled, mcp_unshield_failed, and the unshield's own p03_* codes. A call the app stopped, or one that failed, may still send: call wallet_cancel before you tell the user anything about that send; never say nothing was sent without it. A send is one payment to \`to\`. ${HOST_BLOCKED_LINE}`,
140599
+ description: `Use this when the user says "send 2 USDC to <address>" or "withdraw to my wallet" (for "my wallet" leave \`to\` out: it uses the address saved at setup, or says how to set one; never ask the user first): it sends amount (USDC, like "2"; or amount_atomic) from the PRIVATE balance as plain USDC to \`to\`, a public Solana address. BEFORE you call it to send all of the balance when wallet_balance showed balanceParts above 1, write to the user that the wallet first gets the balance ready to send (do not tell the user how the wallet stores the balance; some apps show nothing until this call ends). Privately: the chain shows the pool paying the address, not which wallet paid. The wallet's own key (ownAddress in wallet_balance) is this wallet's public address: it holds the public USDC, wallet_shield deposits from it, and wallet_transfer_token sells from it. So it is refused as \`to\`: an exit there would show on chain that the private balance belongs to this wallet. This holds whether or not that key ever deposited: wallet_add_funds deposits come from one-time addresses, not from this key, so never tell the user the deposits came from it. Shinjuku pays every network fee; no SOL is needed. The user's saved own addresses (setup or this app's wallet entry) send at once. Any other address is sent only after the user confirms it in a dialog of this app; a client that cannot ask is refused (mcp_unshield_to_not_allowed) and a decline sends nothing (mcp_unshield_declined). \`to\` must already be able to receive USDC: an address that cannot is refused before any dialog (mcp_unshield_to_invalid). It runs in steps and may wait for the pool's next anchor: the call answers within about 20 s with stage (confirming, queued, refreshing, self-pay = preparing, exit = sending, done; joining = the wallet first gets the balance ready to send, then sends; each call goes on with it (joinSteps: its steps, one after another; doneInMinutesLow to doneInMinutesHigh: the time to say), ok: true); call wallet_unshield again with the SAME request_id, amount, and to for the status (each call answers within about 20 s, at once when the send ends; a dialog may take longer). When the wallet must first get the balance ready to send, the FIRST call answers at once with stage joining and joinTellFirst: true; write its say to the user, then call again with the same request_id at once. One exception: for a send whose balance must first be made ready, when this app sends a progress token with the call, that next call gets the balance ready and then sends, with a progress line every ${JOIN_STEP_MS / 1e3} s ("getting your balance ready to send"; some apps show none of them, so the line is said before the call, as above). It answers when the send is done, or after about ${joinAnswerSeconds(JOIN_CALL_MAX_MS)} s with how far it got (joinsDone; sendState sending: the USDC is leaving, never say nothing moved); then call again with the same request_id. Without a progress token it answers within about 20 s with stage joining: call again until it sends. The same request_id never sends twice, also after a restart. request_id is optional: without it the answer names the id it made, and the same call again within 10 minutes after it ends reads that same send. An optional limit the user sets (the unshield limit) may bound each call and what this wallet sends in any 24 hours, from every app that runs it (mcp_unshield_cap_exceeded: tell the user). Other refusals: mcp_argument_invalid, mcp_request_id_reused, wallet_locked, mcp_tool_disabled, mcp_unshield_failed, and the unshield's own p03_* codes. A call the app stopped or calls rejected or interrupted, or one that failed, may still send: call wallet_cancel (no request_id) before you tell the user anything about that send; never say nothing was sent without it. A send is one payment to \`to\`. ${HOST_BLOCKED_LINE}`,
140518
140600
  inputSchema: {
140519
140601
  type: "object",
140520
140602
  properties: {
@@ -144302,7 +144384,7 @@ __export(stdioServer_exports, {
144302
144384
  });
144303
144385
  import { createHash as createHash33 } from "node:crypto";
144304
144386
  import { dirname as dirname31, join as join35, resolve as resolve28, sep as sep4 } from "node:path";
144305
- import { fileURLToPath as fileURLToPath17 } from "node:url";
144387
+ import { fileURLToPath as fileURLToPath18 } from "node:url";
144306
144388
  function createClientBridge() {
144307
144389
  const bridge = {
144308
144390
  capabilities: void 0,
@@ -144585,7 +144667,7 @@ function serveStdio({ input, output: output2, dispatch, log = () => {
144585
144667
  function runningBundleFile({ moduleUrl = new URL("__bundled_source__/wallet/src/mcp/stdioServer.mjs", import.meta.url).href, script = process.argv[1] } = {}) {
144586
144668
  let here3;
144587
144669
  try {
144588
- here3 = fileURLToPath17(moduleUrl);
144670
+ here3 = fileURLToPath18(moduleUrl);
144589
144671
  } catch {
144590
144672
  return void 0;
144591
144673
  }
@@ -145660,7 +145742,7 @@ var init_stdioServer = __esm({
145660
145742
  SUPPORTED_PROTOCOL_VERSIONS = Object.freeze(["2025-06-18", "2025-03-26", "2024-11-05"]);
145661
145743
  MAX_LINE_BYTES = 4 * 1024 * 1024;
145662
145744
  POSITIVE_ATOMIC7 = /^[1-9][0-9]{0,30}$/;
145663
- INSTRUCTIONS_BASE = `A self-custody Shinjuku Shield wallet on this machine; no tool takes or returns its keys or passphrase. Each answer's say is one plain sentence for the user; other fields hold numbers. Never tell the user a tool, field, code or protocol name (x402, MCP) unless told to. Map a plain request to one tool: "what is my balance" -> wallet_balance (safe at any time); "add money" / "deposit" / "move USDC in from Phantom or an exchange" -> wallet_add_funds (a one-time address; the next wallet_balance after the USDC arrives makes it private, up to 5 USDC); "shield the USDC on this wallet's own address" -> wallet_shield; "stop" / "cancel" -> wallet_cancel (the request_id of what to stop); "pay this URL" -> pay_for_service (no preview needed); "what does this URL cost" -> check_price (only when asked); "find a paid API for X" -> find_paid_services, then pay its url; "send 2 USDC to <address>" -> wallet_unshield; "show my payments" -> wallet_receipts; "send another token" -> wallet_transfer_token; "which AI models" -> inference_models; "ask an AI model" -> inference_chat; "give my other AI app a private AI" -> inference_server (a local OpenAI-compatible URL and key). wallet_balance answers ONE balance (balanceAtomic); pay_for_service pays any paid URL from it. Fields ending in Atomic are atomic units (1000000 = 1 USDC); tell the user USDC. The wallet does its own upkeep (no user command). A shield, add-funds or unshield call can run for minutes: call again with the SAME request_id as next says. Pass your own request_id to pay_for_service: the same one never pays or moves money twice (a code ending in _retry_same_request: call again with it). pay_for_service never pays above the spending limits (one payment; 24 hours); with none, the balance is the only bound. Never claim a payment happened unless the answer has a transaction. After a pay or send call that stopped or failed, call wallet_receipts (a payment) or wallet_cancel (a send) before you say whether it happened; never say nothing moved without that. Privacy: the chain does not show which wallet paid, but this app and its model provider see every URL, body, price and answer you handle; reach a seller or its domain only through these tools, never yourself (no curl, browser, DNS or DNS-over-HTTPS lookup), also when the user asks for no Tor: that shows their IP address to the site or a DNS company. When an answer's poolSwitch.items[] item has tellUser true, tell the user its message once, in plain words; the wallet moves the balance by itself.`;
145745
+ INSTRUCTIONS_BASE = `A self-custody Shinjuku Shield wallet on this machine; no tool takes or returns its keys or passphrase. Each answer's say is one plain sentence for the user; other fields hold numbers. Never tell the user a tool, field, code or protocol name (x402, MCP) unless told to. Map a plain request to one tool: "what is my balance" -> wallet_balance (safe at any time); "add money" / "deposit" / "move USDC in from Phantom or an exchange" -> wallet_add_funds (a one-time address; the next wallet_balance after the USDC arrives makes it private, up to 5 USDC); "shield the USDC on this wallet's own address" -> wallet_shield; "stop" / "cancel" -> wallet_cancel (the request_id of what to stop); "pay this URL" -> pay_for_service (no preview needed); "what does this URL cost" -> check_price (only when asked); "find a paid API for X" -> find_paid_services, then pay its url; "send 2 USDC to <address>" -> wallet_unshield; "show my payments" -> wallet_receipts; "send another token" -> wallet_transfer_token; "which AI models" -> inference_models; "ask an AI model" -> inference_chat; "give my other AI app a private AI" -> inference_server. wallet_balance answers ONE balance (balanceAtomic); pay_for_service pays any paid URL from it. Fields ending in Atomic are atomic units (1000000 = 1 USDC); tell the user USDC. The wallet does its own upkeep. A shield, add-funds or unshield call can run for minutes: call again with the SAME request_id as next says. Pass your own request_id to pay_for_service: the same one never pays or moves money twice (a code ending in _retry_same_request: call again with it). pay_for_service never pays above the spending limits (one payment; 24 hours); with none, the balance is the only bound. Never claim a payment happened unless the answer has a transaction. After a pay or send call that stopped or failed (also one this app calls rejected or interrupted), call wallet_receipts (a payment) or wallet_cancel (a send; no request_id) before you say whether it happened; never say nothing moved without that. Privacy: the chain does not show which wallet paid, but this app and its model provider see every URL, body, price and answer you handle; reach a seller or its domain only through these tools, never yourself (no curl, browser, DNS or DNS-over-HTTPS lookup), also when the user asks for no Tor: that shows their IP address to the site or a DNS company. When an answer's poolSwitch.items[] item has tellUser true, tell the user its message once, in plain words; the wallet moves the balance by itself.`;
145664
145746
  SELL_LINE = "To sell or swap a token the wallet holds: wallet_transfer_token.";
145665
145747
  OWN_ADDRESS_LINE = '"Send to my (main) wallet": wallet_unshield with no to uses the address saved at setup; never ask for it.';
145666
145748
  INSTRUCTIONS = `${INSTRUCTIONS_BASE} ${SELL_LINE} ${OWN_ADDRESS_LINE} ${HOST_BLOCKED_LINE}`;
@@ -147238,7 +147320,7 @@ var init_serveRunner = __esm({
147238
147320
  // wallet/src/pay/cli.mjs
147239
147321
  import { createHash as createHash34 } from "node:crypto";
147240
147322
  import { resolve as resolve30 } from "node:path";
147241
- import { fileURLToPath as fileURLToPath18 } from "node:url";
147323
+ import { fileURLToPath as fileURLToPath19 } from "node:url";
147242
147324
  async function main4(args = process.argv.slice(2)) {
147243
147325
  if (args.length === 1 && args[0] === "--help") {
147244
147326
  console.log(USAGE2);
@@ -147418,7 +147500,7 @@ var init_cli3 = __esm({
147418
147500
  init_errorLine();
147419
147501
  USAGE2 = "node --import tsx wallet/src/pay/cli.mjs --wallet <encrypted-file> --passphrase-file <file> [--rpc-file <file>] --proof-tools <manifest> --program <address> --url <seller-url> --request-id <stable-id> --maximum-atomic <amount> --memo-service <url> [--method GET|POST] [--body-file <private-file>] [--headers-file <private-json-object>] [--account-file <recovered-account-json>] [--out <private-file>] [--history-rpc <own|url>]";
147420
147502
  REQUIRED2 = ["wallet", "passphrase-file", "proof-tools", "program", "url", "request-id", "maximum-atomic", "memo-service"];
147421
- if (process.argv[1] && resolve30(process.argv[1]) === fileURLToPath18(new URL("__bundled_source__/wallet/src/pay/cli.mjs", import.meta.url).href)) {
147503
+ if (process.argv[1] && resolve30(process.argv[1]) === fileURLToPath19(new URL("__bundled_source__/wallet/src/pay/cli.mjs", import.meta.url).href)) {
147422
147504
  main4().catch((error) => {
147423
147505
  console.error(describeCliErrorWithHint(error));
147424
147506
  process.exitCode = 1;
@@ -151078,7 +151160,7 @@ __export(cli_exports, {
151078
151160
  startSeller: () => startSeller
151079
151161
  });
151080
151162
  import { join as join47, resolve as resolve40 } from "node:path";
151081
- import { fileURLToPath as fileURLToPath21 } from "node:url";
151163
+ import { fileURLToPath as fileURLToPath22 } from "node:url";
151082
151164
  async function startSeller(config, { fetchImpl = fetch, rpcFetch: rpcFetch2 } = {}) {
151083
151165
  let release;
151084
151166
  try {
@@ -151330,7 +151412,7 @@ var init_cli4 = __esm({
151330
151412
  return "?";
151331
151413
  }
151332
151414
  };
151333
- if (process.argv[1] && resolve40(process.argv[1]) === fileURLToPath21(new URL("__bundled_source__/wallet/src/seller/cli.mjs", import.meta.url).href)) {
151415
+ if (process.argv[1] && resolve40(process.argv[1]) === fileURLToPath22(new URL("__bundled_source__/wallet/src/seller/cli.mjs", import.meta.url).href)) {
151334
151416
  main7().catch(() => {
151335
151417
  console.error("p03_seller_start_failed");
151336
151418
  process.exitCode = 1;
@@ -151363,7 +151445,7 @@ init_timing();
151363
151445
  import { randomBytes as randomBytes34 } from "node:crypto";
151364
151446
  import { dirname as dirname37, join as join48, resolve as resolve41 } from "node:path";
151365
151447
  import { spawn as spawn13 } from "node:child_process";
151366
- import { fileURLToPath as fileURLToPath22 } from "node:url";
151448
+ import { fileURLToPath as fileURLToPath23 } from "node:url";
151367
151449
 
151368
151450
  // wallet/src/fetch/index.mjs
151369
151451
  init_session();
@@ -152423,7 +152505,7 @@ init_secretFile();
152423
152505
  init_usdcWords();
152424
152506
  init_commandName();
152425
152507
  import { resolve as resolve34 } from "node:path";
152426
- import { fileURLToPath as fileURLToPath19 } from "node:url";
152508
+ import { fileURLToPath as fileURLToPath20 } from "node:url";
152427
152509
  var usage = () => commandLine("prepare --wallet <encrypted-file> --passphrase-file <file> --program <address> [--dry-run] [--rpc-file <file>] --proof-tools <manifest> --profile <public-profile.json> --facilitator <https-origin> [--history-rpc <own|url>]");
152428
152510
  var VALUED = ["wallet", "passphrase-file", "program", "rpc-file", "proof-tools", "profile", "facilitator", "history-rpc"];
152429
152511
  var ALWAYS = ["wallet", "passphrase-file", "program"];
@@ -152568,7 +152650,7 @@ async function main5(args = process.argv.slice(2), { output: output2 = (result)
152568
152650
  await release();
152569
152651
  }
152570
152652
  }
152571
- if (process.argv[1] && resolve34(process.argv[1]) === fileURLToPath19(new URL("__bundled_source__/wallet/src/merge/cli.mjs", import.meta.url).href)) {
152653
+ if (process.argv[1] && resolve34(process.argv[1]) === fileURLToPath20(new URL("__bundled_source__/wallet/src/merge/cli.mjs", import.meta.url).href)) {
152572
152654
  main5().catch((error) => {
152573
152655
  console.error(describeCliErrorWithHint(error));
152574
152656
  process.exitCode = 1;
@@ -153158,7 +153240,7 @@ init_deposit();
153158
153240
  import { createPrivateKey as createPrivateKey3, sign as sign2 } from "node:crypto";
153159
153241
  import { createRequire } from "node:module";
153160
153242
  import { dirname as dirname35, join as join40, resolve as resolve36 } from "node:path";
153161
- import { fileURLToPath as fileURLToPath20, pathToFileURL as pathToFileURL2 } from "node:url";
153243
+ import { fileURLToPath as fileURLToPath21, pathToFileURL as pathToFileURL3 } from "node:url";
153162
153244
 
153163
153245
  // wallet/src/deposit/privacyCashLocal.mjs
153164
153246
  var import_web3136 = __toESM(require_index_cjs(), 1);
@@ -153166,7 +153248,7 @@ init_esm2();
153166
153248
  init_chain2();
153167
153249
  import { randomInt as randomInt9 } from "node:crypto";
153168
153250
  import { dirname as dirname34, join as join39 } from "node:path";
153169
- import { pathToFileURL } from "node:url";
153251
+ import { pathToFileURL as pathToFileURL2 } from "node:url";
153170
153252
  var PRIVACY_CASH_RELAY_SCHEMA = "carbon-shielded-x402/privacy-cash-relay/v1";
153171
153253
  var PRIVACY_CASH_RELAY_CONFIG_SCHEMA = "carbon-shielded-x402/privacy-cash-relay-config/v1";
153172
153254
  var MAX_TRANSACTION_BYTES = 1232;
@@ -153194,7 +153276,7 @@ var zeroPath = () => Array.from({ length: TREE_DEPTH2 }, () => "0");
153194
153276
  var toBeBytes = (decimal5) => Buffer.from(BigInt(decimal5).toString(16).padStart(64, "0"), "hex");
153195
153277
  async function loadPrivacyCashInternals(sdk, ids) {
153196
153278
  const dist = join39(dirname34(dirname34(sdk.keyBasePath)), "dist");
153197
- const load = (path) => import(pathToFileURL(join39(dist, path)).href);
153279
+ const load = (path) => import(pathToFileURL2(join39(dist, path)).href);
153198
153280
  const [{ Utxo }, { Keypair: UtxoKeypair }, prover, utils, encryption, constants2, { MerkleTree }] = await Promise.all([
153199
153281
  load("models/utxo.js"),
153200
153282
  load("models/keypair.js"),
@@ -154277,7 +154359,7 @@ async function quietly(operation) {
154277
154359
  }
154278
154360
  function sdkFolders(sdkDir) {
154279
154361
  if (sdkDir) return [resolve36(sdkDir)];
154280
- const folders = [fileURLToPath20(new URL("../../privacy-cash/", new URL("__bundled_source__/wallet/src/deposit/privacyCash.mjs", import.meta.url).href))];
154362
+ const folders = [fileURLToPath21(new URL("../../privacy-cash/", new URL("__bundled_source__/wallet/src/deposit/privacyCash.mjs", import.meta.url).href))];
154281
154363
  if (process.argv[1]) folders.push(resolve36(dirname35(process.argv[1]), "..", "privacy-cash"));
154282
154364
  return folders;
154283
154365
  }
@@ -154285,7 +154367,7 @@ function esmEntry(fromPackageDir, name) {
154285
154367
  const manifestPath3 = createRequire(join40(fromPackageDir, "package.json")).resolve(`${name}/package.json`);
154286
154368
  const entry = JSON.parse(readFileSync(manifestPath3, "utf8")).exports?.["."]?.import;
154287
154369
  if (typeof entry !== "string") fail45("sdk_missing");
154288
- return pathToFileURL2(join40(dirname35(manifestPath3), entry)).href;
154370
+ return pathToFileURL3(join40(dirname35(manifestPath3), entry)).href;
154289
154371
  }
154290
154372
  async function loadPrivacyCashSdk({ sdkDir } = {}) {
154291
154373
  if (!(Number(process.versions.node.split(".")[0]) >= 24)) fail45("node_too_old");
@@ -154303,7 +154385,7 @@ async function loadPrivacyCashSdk({ sdkDir } = {}) {
154303
154385
  if (!existsSync(`${keyBasePath}.wasm`) || !existsSync(`${keyBasePath}.zkey`)) fail45("sdk_circuit_missing");
154304
154386
  try {
154305
154387
  return await quietly(async () => {
154306
- const utils = await import(pathToFileURL2(join40(packageDir, "dist", "exportUtils.js")).href);
154388
+ const utils = await import(pathToFileURL3(join40(packageDir, "dist", "exportUtils.js")).href);
154307
154389
  const { WasmFactory } = await import(esmEntry(packageDir, "@lightprotocol/hasher.rs"));
154308
154390
  utils.setLogger(() => {
154309
154391
  });
@@ -157191,6 +157273,12 @@ var npmProxyEnvironment = (url) => ({
157191
157273
  NO_PROXY: "",
157192
157274
  no_proxy: ""
157193
157275
  });
157276
+ function withNoProxyArg(entry) {
157277
+ const at = entry.args.indexOf("npx");
157278
+ const index = entry.command === "npx" ? 0 : at + 1;
157279
+ if (entry.command !== "npx" && at < 0) return entry;
157280
+ return { ...entry, args: [...entry.args.slice(0, index), "--noproxy=", ...entry.args.slice(index)] };
157281
+ }
157194
157282
  var NPM_ONLINE_ENVIRONMENT = Object.freeze({ npm_config_offline: "false", npm_config_prefer_offline: "false", npm_config_prefer_online: "true" });
157195
157283
  var NPM_OFFLINE_ENVIRONMENT = Object.freeze({ npm_config_offline: "true" });
157196
157284
  var NPM_CACHE_KEYS = /* @__PURE__ */ new Set(["npm_config_cache", "npm_config_userconfig", "npm_config_globalconfig", "npm_config_prefix"]);
@@ -160363,7 +160451,7 @@ function validateMcp(values, env) {
160363
160451
  function requireMcpCaps(values) {
160364
160452
  for (const name of ["--max-payment", "--max-session"]) if (!values.has(name)) values.set(name, NO_LIMIT_ATOMIC);
160365
160453
  }
160366
- var CLI_FILE = fileURLToPath22(new URL("__bundled_source__/wallet/src/cli/shinjukuWallet.mjs", import.meta.url).href);
160454
+ var CLI_FILE = fileURLToPath23(new URL("__bundled_source__/wallet/src/cli/shinjukuWallet.mjs", import.meta.url).href);
160367
160455
  var cliEntry2;
160368
160456
  var setCliEntry = (file) => {
160369
160457
  cliEntry2 = typeof file === "string" && file ? file : void 0;
@@ -161688,7 +161776,7 @@ function hostStartCheck(app, options, deps, { terminal, noTor = false, cwd }) {
161688
161776
  `);
161689
161777
  const start = async (entry) => {
161690
161778
  if (!net4.url) return check(entry, { platform, env, terminal, extraEnv: NPM_ONLINE_ENVIRONMENT, ...at });
161691
- const filled = await check(entry, { platform, env, terminal, extraEnv: npmProxyEnvironment(net4.url), ...at });
161779
+ const filled = await check(withNoProxyArg(entry), { platform, env, terminal, extraEnv: npmProxyEnvironment(net4.url), ...at });
161692
161780
  if (!filled.ok) return filled;
161693
161781
  return check(entry, { platform, env, terminal, extraEnv: NPM_OFFLINE_ENVIRONMENT, ...at });
161694
161782
  };
@@ -161791,7 +161879,7 @@ ${claudeCodeLines({ ...claudeOptions, claudeProgram }).map((line) => ` ${line}`
161791
161879
  if (removed && status !== 0) status = runClaudeCli(claudeCodeArgs(options));
161792
161880
  if (status === 0) done.add(target);
161793
161881
  const homeNow = replacedOther ? ` Claude Code now uses the wallet in ${home}; the wallet in ${otherHome} is unchanged.` : "";
161794
- io.out(status === 0 ? `${removed ? "Replaced the wallet in" : "Added the wallet to"} Claude Code, for all your folders.${homeNow} ${allowWalletChecks(deps).say} ${RESTART_APP("Claude Code")}
161882
+ io.out(status === 0 ? `${removed ? "Replaced the wallet in" : "Added the wallet to"} Claude Code, for all your folders.${homeNow} ${allowWalletChecks(deps).say} ${RESTART_APP("Claude Code")}${noStartFolderWords(target, mcpServerEntry(options))}
161795
161883
  ` : `Claude Code did not take the server; its message is above. Run this yourself:
161796
161884
  ${claudeCodeLines({ ...claudeOptions, claudeProgram }).map((line) => ` ${line}`).join("\n")}
161797
161885
  ` + (removed ? `Setup removed the old ${MCP_SERVER_NAME} entry first, so Claude Code has none until that line runs.
@@ -161815,19 +161903,22 @@ ${claudeRemoveLines(claudeProgram, options.platform)}
161815
161903
  `);
161816
161904
  continue;
161817
161905
  }
161818
- const check = await hostStartCheck(app, options, deps, { terminal: false, noTor, ...target === "hermes" ? { cwd: resolve41(home) } : {} });
161906
+ const startFolder = hostStartFolder(target, mcpServerEntry(options));
161907
+ const check = await hostStartCheck(app, options, deps, { terminal: false, noTor, ...startFolder ? { cwd: startFolder } : {} });
161819
161908
  if (!check.ok) {
161820
161909
  io.out(`Not added to ${app}: ${hostCheckWords(app, check)}
161821
161910
  `);
161822
161911
  continue;
161823
161912
  }
161824
161913
  try {
161825
- const write = (entry, writeForce) => target === "codex" || target === "grok" ? addToCodexHost(file, entry, { force: writeForce, app }) : target === "hermes" ? addToHermesHost(file, entry, { force: writeForce }) : target === "continue" ? addToContinueHost(file, hostEntry(target, entry), { force: writeForce }) : addToJsonHost(file, hostEntry(target, entry), { force: writeForce, key: hostServersKey(target) });
161826
- const added = write(mcpServerEntry({ ...options, ...check.path ? { path: check.path } : {} }), force);
161914
+ const write = (entry, writeForce) => target === "codex" || target === "grok" ? addToCodexHost(file, hostEntry(target, entry, options.platform), { force: writeForce, app }) : target === "hermes" ? addToHermesHost(file, entry, { force: writeForce }) : target === "continue" ? addToContinueHost(file, hostEntry(target, entry, options.platform), { force: writeForce }) : addToJsonHost(file, hostEntry(target, entry, options.platform), { force: writeForce, key: hostServersKey(target) });
161915
+ const written = mcpServerEntry({ ...options, ...check.path ? { path: check.path } : {} });
161916
+ const added = write(written, force);
161917
+ const folderWords = noStartFolderWords(target, written);
161827
161918
  for (const old of added.replaced ?? []) io.out(`Replaced the old ${old} entry in ${app}.
161828
161919
  `);
161829
- io.out(!added.changed ? `${app} already has the wallet: ${file} (nothing changed). The wallet starts with this entry (checked). If ${app} does not show the wallet yet: ${hostAddedNext(target, app, options.platform)}
161830
- ` : `Added the wallet to ${app}: ${file}${added.backup ? ` (the old file was copied to ${added.backup}, readable by you alone)` : ""}. The wallet starts with this entry (checked). ${hostAddedNext(target, app, options.platform)}
161920
+ io.out(!added.changed ? `${app} already has the wallet: ${file} (nothing changed). The wallet starts with this entry (checked). If ${app} does not show the wallet yet: ${hostAddedNext(target, app, options.platform)}${folderWords}
161921
+ ` : `Added the wallet to ${app}: ${file}${added.backup ? ` (the old file was copied to ${added.backup}, readable by you alone)` : ""}. The wallet starts with this entry (checked). ${hostAddedNext(target, app, options.platform)}${folderWords}
161831
161922
  `);
161832
161923
  done.add(target);
161833
161924
  } catch (error) {
@@ -162146,7 +162237,10 @@ async function runSetupCommand(values, deps) {
162146
162237
  readsBack ? "Setup keeps the restored wallet on this machine (your keys never leave it), downloads and checks the setup files, and writes config.json." : "Setup makes the wallet on this machine (your keys never leave it), downloads and checks the setup files, and writes config.json.",
162147
162238
  // 0.3.97 T4, live proof 2026-10-24: the command on its own line.
162148
162239
  "An agent app then starts it with this command:",
162149
- ` ${oneTimeCommandLine("mcp", npmVersion)}`,
162240
+ // Row 25 rerun on 0.3.174 (check C): the line a user may copy into an app setup cannot add has the app entry's
162241
+ // --prefix (npm reads no .npmrc of the folder the app starts in); a Windows home with a cmd sign, $ or ` gets none, as
162242
+ // the entry. Quoted for the user's shell (hostShellWord: single quotes on POSIX; Codex round 1 on 1b3aaa99 item 2).
162243
+ ` ${oneTimeCommandLine("mcp", npmVersion, { npmArgs: npmPrefixArgs(home, deps.platform ?? process.platform).map((word2) => hostShellWord(word2, deps.platform ?? process.platform)) })}`,
162150
162244
  ""
162151
162245
  ],
162152
162246
  // The status line too, when a terminal setup started this run and printed it (AB234's live run 2026-11-04 showed
@@ -165317,7 +165411,7 @@ async function runTransferTokenCli(values, deps, io) {
165317
165411
  `);
165318
165412
  }
165319
165413
  function sellerIdentityOf(store) {
165320
- const generator2 = JSON.parse(readFileSync(fileURLToPath22(new URL(
165414
+ const generator2 = JSON.parse(readFileSync(fileURLToPath23(new URL(
165321
165415
  "../../vendor/shielded-x402-model/vectors/rust-vectors.json",
165322
165416
  new URL("__bundled_source__/wallet/src/cli/shinjukuWallet.mjs", import.meta.url).href
165323
165417
  )), "utf8")).payerKeys.generator;