shinjuku-shielded 0.3.162 → 0.3.163

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,19 +6,19 @@ 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.162. The npm packages `shinjuku-shield` and
9
+ This is version 0.3.163. 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
- npm install -g shinjuku@0.3.162
15
+ npm install -g shinjuku@0.3.163
16
16
  shinjuku setup
17
17
  ```
18
18
 
19
19
  Type the two lines as they are. `npx install shinjuku` does not work: npx
20
20
  reads `install` as the name of another npm package. To set up without
21
- installing, type `npx shinjuku@0.3.162 setup`.
21
+ installing, type `npx shinjuku@0.3.163 setup`.
22
22
 
23
23
  Setup makes the wallet on this machine, a private passphrase file, and the
24
24
  checked proof tools (about 191 MB), and writes `config.json`. It also writes
@@ -36,13 +36,13 @@ Every wallet command works after `shinjuku`, for example `shinjuku balance`,
36
36
  Claude Code:
37
37
 
38
38
  ```sh
39
- claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.162 mcp
39
+ claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.163 mcp
40
40
  ```
41
41
 
42
42
  Claude Desktop (`claude_desktop_config.json`) or Cursor (`~/.cursor/mcp.json`):
43
43
 
44
44
  ```json
45
- { "mcpServers": { "shinjuku": { "command": "npx", "args": ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.162", "mcp"] } } }
45
+ { "mcpServers": { "shinjuku": { "command": "npx", "args": ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.163", "mcp"] } } }
46
46
  ```
47
47
 
48
48
  On native Windows, if the host cannot find `npx`, use `"command": "cmd"` and
@@ -55,7 +55,7 @@ Codex (the Codex app and Codex CLI read the same file, `~/.codex/config.toml`):
55
55
  ```toml
56
56
  [mcp_servers.shinjuku]
57
57
  command = "npx"
58
- args = ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.162", "mcp"]
58
+ args = ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.163", "mcp"]
59
59
  startup_timeout_sec = 120
60
60
  tool_timeout_sec = 300
61
61
  ```
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": "424f0dda8e881f18e02c8fb9b224deaa3c4f65476f26e5f66e4a6dbb30ff2d88",
5
- "bytes": 9260304,
6
- "sourceCommit": "d0b7984abb8e01c8c2f58b4f129ec364661902ba",
4
+ "sha256": "7a038d95a5e6a448ffafbb485aac78f879c5ff57a261b73a263ffa5e9c9b6116",
5
+ "bytes": 9273268,
6
+ "sourceCommit": "a9266e0d997236ebda569133164c00848ac8a726",
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-04T07:53:19.515Z"
1041
+ "publishedAt": "2026-11-04T10:20:37.517Z"
1042
1042
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "shinjuku-shielded",
3
- "version": "0.3.162",
3
+ "version": "0.3.163",
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": "424f0dda",
7
- "shinjukuSha256": "424f0dda8e881f18e02c8fb9b224deaa3c4f65476f26e5f66e4a6dbb30ff2d88",
6
+ "shinjukuRelease": "7a038d95",
7
+ "shinjukuSha256": "7a038d95a5e6a448ffafbb485aac78f879c5ff57a261b73a263ffa5e9c9b6116",
8
8
  "license": "SEE LICENSE IN LICENSE.txt",
9
9
  "author": "Shinjuku Shielded",
10
10
  "homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
@@ -146622,9 +146622,12 @@ async function openHomeScreen({ stdout = process.stdout, stdin = process.stdin,
146622
146622
  if (view2) screenText(view2.screen, codes).forEach((line, y) => {
146623
146623
  if (line) out += `\x1B[${y + 1};1H${line}`;
146624
146624
  });
146625
- else TOO_SMALL.forEach((line, y) => {
146626
- out += `\x1B[${y + 1};1H${fit(line, columns - 1)}`;
146627
- });
146625
+ else {
146626
+ tooSmallLines(columns, stdout.rows).forEach(([mark, line], y) => {
146627
+ const text3 = fit(`${mark}${line}`, columns - 1);
146628
+ out += `\x1B[${y + 1};1H${codes && mark ? `${codes.crim}${mark}${codes.bone}${text3.slice(mark.length)}\x1B[0m` : codes ? `${codes.dim}${text3}\x1B[0m` : text3}`;
146629
+ });
146630
+ }
146628
146631
  write(`${out}\x1B[?2026l`);
146629
146632
  };
146630
146633
  const spin = () => {
@@ -146776,8 +146779,13 @@ async function waitForRoom({ stdout = process.stdout, stdin = process.stdin, env
146776
146779
  } catch {
146777
146780
  }
146778
146781
  };
146782
+ const mark = (() => {
146783
+ const codes = paletteFor(screenColor(stdout, env));
146784
+ return codes ? `${codes.crim}\u25C6 ${codes.bone}shinjuku-shield\x1B[0m` : "\u25C6 shinjuku-shield";
146785
+ })();
146779
146786
  const say3 = () => write([
146780
146787
  "\x1B[0m\x1B[2J\x1B[H",
146788
+ mark,
146781
146789
  "This window is too small for the wallet screen.",
146782
146790
  `It needs ${needs.columns} x ${needs.rows}; this one is ${stdout.columns} x ${stdout.rows}.`,
146783
146791
  "Make the window larger: the screen opens by itself.",
@@ -146816,7 +146824,7 @@ async function waitForRoom({ stdout = process.stdout, stdin = process.stdin, env
146816
146824
  }
146817
146825
  }
146818
146826
  }
146819
- var MIN_COLUMNS, WIDE_COLUMNS, WIDE_WIDTH, LEFT_X, LEFT_WIDTH, PANEL_X, PANEL_WIDTH, TOP, BAND_MS, BAND_CHANCE, KATAKANA, FONT, AGENT_KEY, HELP_KEY, QUIT_KEY, KEY_HELP, lettersOf, PANELS, ALL_PIECES, KEYS_LINE, FIRST_LINES, SETUP_KEY, RESTORE_KEY, END_KEYS, RESTORE_STEP, HINT, TOO_SMALL, COLORS, COLORS_16, RESET2, DATA_SYMBOLS, HOME_SHAPE, FIRST_SHAPE, WIDE, WORD_TOP, WORD_BOTTOM, WORD_WIDTH, ROMAJI, BIG_MARK, SMALL_MARK, LOCKUP_GAP, LOCKUP_WIDTH, Screen, setupLine, randomKatakana, MARK_TONES, PUBLIC_STEP, stackHeight;
146827
+ var MIN_COLUMNS, WIDE_COLUMNS, WIDE_WIDTH, LEFT_X, LEFT_WIDTH, PANEL_X, PANEL_WIDTH, TOP, BAND_MS, BAND_CHANCE, KATAKANA, FONT, AGENT_KEY, HELP_KEY, QUIT_KEY, KEY_HELP, lettersOf, PANELS, ALL_PIECES, KEYS_LINE, FIRST_LINES, SETUP_KEY, RESTORE_KEY, END_KEYS, RESTORE_STEP, HINT, tooSmallLines, COLORS, COLORS_16, RESET2, DATA_SYMBOLS, HOME_SHAPE, FIRST_SHAPE, WIDE, WORD_TOP, WORD_BOTTOM, WORD_WIDTH, ROMAJI, BIG_MARK, SMALL_MARK, LOCKUP_GAP, LOCKUP_WIDTH, Screen, setupLine, randomKatakana, MARK_TONES, PUBLIC_STEP, stackHeight;
146820
146828
  var init_homeScreen = __esm({
146821
146829
  "wallet/src/cli/homeScreen.mjs"() {
146822
146830
  "use strict";
@@ -146880,7 +146888,16 @@ var init_homeScreen = __esm({
146880
146888
  END_KEYS = [HELP_KEY, QUIT_KEY];
146881
146889
  RESTORE_STEP = "or press r to restore it from your recovery file in a new folder.";
146882
146890
  HINT = "? help \xB7 q quit";
146883
- TOO_SMALL = ["this window is too small for the wallet screen.", "press q to quit. make the window larger,", "then start the wallet again."];
146891
+ tooSmallLines = (columns, rows2) => {
146892
+ const needs = homeScreenNeeds();
146893
+ return [
146894
+ ["\u25C6 ", "shinjuku-shield"],
146895
+ ["", "this window is too small for the wallet screen."],
146896
+ ["", `it needs ${needs.columns} x ${needs.rows}; this one is ${columns} x ${rows2}.`],
146897
+ ["", "press q to quit. make the window larger,"],
146898
+ ["", "then start the wallet again."]
146899
+ ];
146900
+ };
146884
146901
  COLORS = {
146885
146902
  crim: "#D4202A",
146886
146903
  crimdim: "#6E0A11",
@@ -147057,6 +147074,27 @@ function chatHeaderLines({ color, columns, version: version3, model: model2, row
147057
147074
  for (const [label, parts] of rows2) lines.push(paint([[" ", ""], [label.padEnd(12), "dim"], ...parts], color));
147058
147075
  return lines;
147059
147076
  }
147077
+ function brandHeaderLines({ color, columns, title, panel }) {
147078
+ if (!color || !(columns >= HEADER_COLUMNS)) return [`\u25C6 shinjuku-shield \xB7 ${title}`, ""];
147079
+ const width = Math.min(columns - 1, 100);
147080
+ const used = (parts) => parts.reduce((sum2, [text3]) => sum2 + columnsOf(text3), 0);
147081
+ const left = [["\u25C6 ", "crim"], ["shinjuku-shield", "bone"]];
147082
+ const right = [[title, "verm"]];
147083
+ const lines = [
147084
+ paint([[" ", ""], ...left, [" ".repeat(Math.max(1, width - 1 - used(left) - used(right))), ""], ...right], color),
147085
+ paint([["\u2500".repeat(width), "ash"]], color)
147086
+ ];
147087
+ const mark = markRows();
147088
+ const wordRows = [...wordmark("SHINJUKU").map((text3) => [[text3, "crim"]]), ...wordmark("SHIELD").map((text3) => [[text3, "bone"]]), [], ROMAJI];
147089
+ for (let y = 0; y < Math.max(mark.length, wordRows.length); y += 1) {
147090
+ const markParts = mark[y] ? joinParts2(mark[y]) : [[" ".repeat(COMPACT_MARK.width), ""]];
147091
+ lines.push(paint([[" ", ""], ...markParts, [" ", ""], ...wordRows[y] ?? []], color).replace(/\s+(\x1b\[0m)?$/, "$1"));
147092
+ }
147093
+ lines.push("");
147094
+ const head = [["\u25BE ", "mute"], ...panel ? [[panel[0], "crim"], [` ${panel[1]} `, "mute"], ["\xB7 ", "bone"]] : [], [title, "bone"], [" ", ""]];
147095
+ lines.push(paint([...head, ["\u2500".repeat(Math.max(1, width - used(head) - 2)), "ash"]], color));
147096
+ return lines;
147097
+ }
147060
147098
  function chatEndLines({ color, columns }) {
147061
147099
  if (!color || !(columns >= HEADER_COLUMNS)) return [];
147062
147100
  const statements = [...STATEMENTS].map((ch) => [ch, ch === "." ? "verm" : "bone"]);
@@ -156114,6 +156152,103 @@ async function playOpenAnimation({ stdout = process.stdout, stdin = process.stdi
156114
156152
 
156115
156153
  // wallet/src/cli/shinjukuWallet.mjs
156116
156154
  init_homeScreen();
156155
+
156156
+ // wallet/src/cli/setupTheme.mjs
156157
+ init_homeScreen();
156158
+ init_brand();
156159
+ var SETUP_THEME_ENV = "SHINJUKU_WALLET_SETUP_THEME";
156160
+ var RESET3 = "\x1B[0m";
156161
+ function setupThemeOn({ stdout = process.stdout, env = process.env, interactive, stdinIsTTY }) {
156162
+ if (!stdout?.isTTY || (env.CI ?? "") !== "" || env.TERM === "dumb") return false;
156163
+ return interactive && stdinIsTTY || env[SETUP_THEME_ENV] === "1";
156164
+ }
156165
+ function setupPainter({ stdout = process.stdout, env = process.env } = {}) {
156166
+ const codes = paletteFor(screenColor(stdout, env));
156167
+ return (parts) => parts.map(([text3, cls]) => codes && cls ? `${codes[cls]}${text3}${RESET3}` : text3).join("");
156168
+ }
156169
+ var STEP = /\.\.\.$/;
156170
+ var DONE = /^(Shinjuku Shield is set up\.|The shinjuku command is installed\.|This computer's setup files are ready\.)/;
156171
+ var WARN = /^(BACK UP NOW|Copy it to two offline places|Wallet created\.|Keep the passphrase file|Without a backup|No spending limit is set)/;
156172
+ var FAIL = /(^| )(failed|refused)\b|^[a-z]+_[a-z_]+: |^(Unknown command|There is no such command|Pay takes its link)\b|^shinjuku [a-z][a-z-]*(?: (?!stopped:)[a-z][a-z-]*)?: /;
156173
+ var PROGRESS = /^(downloading the setup files|tor: |history: )/;
156174
+ var LABEL = /^ {2}([a-z][a-z -]{1,12}?)( {2,}|(?<=^ {2}.{12}) )(\S.*)$/;
156175
+ var COMMAND = /^ {2}(npx |shinjuku |claude |codex |cursor |\$ )/;
156176
+ var NEXT = /^(Next|Status|Home|Then): ?(.*)$/;
156177
+ function paintSetupLine(line, paint2) {
156178
+ if (line === "" || line.includes("\x1B[")) return line;
156179
+ if (DONE.test(line)) return paint2([["\u25C6 ", "crim"], [line, "verm"]]);
156180
+ if (FAIL.test(line)) return paint2([["\u25CB ", "crim"], [line, "crim"]]);
156181
+ if (WARN.test(line)) return paint2([["! ", "verm"], [line, "verm"]]);
156182
+ if (STEP.test(line)) return paint2([["\u25C6 ", "crim"], [line, "bone"]]);
156183
+ if (PROGRESS.test(line)) return paint2([[" ", ""], [line, "mute"]]);
156184
+ if (COMMAND.test(line)) return paint2([[" ", ""], [line.slice(2), "brass"]]);
156185
+ const label = LABEL.exec(line);
156186
+ if (label) return paint2([[" ", ""], [label[1] + label[2], "mute"], [label[3], "bone"]]);
156187
+ const next = NEXT.exec(line);
156188
+ if (next) return paint2([[`${next[1]}:`, "brass"], [next[2] ? ` ${next[2]}` : "", "bone"]]);
156189
+ return paint2([[line, "dim"]]);
156190
+ }
156191
+ var THEME_CHILD_ENV = "SHINJUKU_WALLET_THEMED";
156192
+ function terminalThemeOn({ stdout = process.stdout, env = process.env } = {}) {
156193
+ return Boolean(stdout?.isTTY) && (env.CI ?? "") === "" && env.TERM !== "dumb";
156194
+ }
156195
+ function paintChunk(chunk, paint2) {
156196
+ if (typeof chunk !== "string") return chunk;
156197
+ const text3 = chunk;
156198
+ if (text3.includes("\x1B") || text3.length <= 2 || !/[A-Za-z]/.test(text3)) return chunk;
156199
+ return text3.split("\n").map((line) => {
156200
+ const [, back, rest] = /^(\r*)([^]*)$/.exec(line);
156201
+ return rest.trim() === "" ? line : `${back}${paintSetupLine(rest, paint2)}`;
156202
+ }).join("\n");
156203
+ }
156204
+ function themeStreams(paint2, streams = [process.stdout, process.stderr]) {
156205
+ const undo = streams.map((stream) => {
156206
+ const original = stream.write;
156207
+ stream.write = function themedWrite(chunk, ...rest) {
156208
+ return original.call(stream, paintChunk(chunk, paint2), ...rest);
156209
+ };
156210
+ return () => {
156211
+ stream.write = original;
156212
+ };
156213
+ });
156214
+ return () => undo.forEach((off) => off());
156215
+ }
156216
+ var PANELS2 = {
156217
+ "private balance": ["\u8CA1\u5E03", "saifu"],
156218
+ "add funds": ["\u8CA1\u5E03", "saifu"],
156219
+ "send money out": ["\u8CA1\u5E03", "saifu"],
156220
+ "save a backup": ["\u8CA1\u5E03", "saifu"],
156221
+ "spending limits": ["\u8CA1\u5E03", "saifu"],
156222
+ "pay a link": ["\u6255", "harai"],
156223
+ pay: ["\u6255", "harai"]
156224
+ };
156225
+ function commandHeader(columns = 80, title = "wallet", { stream = process.stdout, env = process.env } = {}) {
156226
+ return `${brandHeaderLines({ color: brandColor(stream, env), columns, title, panel: PANELS2[title] }).join("\n")}
156227
+ `;
156228
+ }
156229
+ function commandFooter(columns = 80, { stream = process.stdout, env = process.env } = {}) {
156230
+ const lines = chatEndLines({ color: brandColor(stream, env), columns });
156231
+ return lines.length ? `${lines.join("\n")}
156232
+ ` : "";
156233
+ }
156234
+ function themedIo(io, paint2) {
156235
+ const draw = (text3) => String(text3).split("\n").map((line) => paintSetupLine(line, paint2)).join("\n");
156236
+ return { ...io, out: (text3) => io.out(draw(text3)), err: (text3) => io.err(draw(text3)) };
156237
+ }
156238
+ var themedAsk = (ask, paint2) => (prompt, ...rest) => String(prompt).startsWith("? ") || String(prompt).includes("\x1B[") ? ask(prompt, ...rest) : ask(paint2([["? ", "crim"], [String(prompt), "bone"]]), ...rest);
156239
+ function setupHeader(paint2, columns = 80, title = "set up the wallet") {
156240
+ return `\x1B[0m\x1B[2J\x1B[H${commandHeader(columns, title)}
156241
+ `;
156242
+ }
156243
+ function setupFooter(paint2, columns = 80) {
156244
+ const width = Math.max(20, Math.min((columns || 80) - 1, 100));
156245
+ return `
156246
+ ${paint2([["\u2500".repeat(width), "ash"]])}
156247
+ ${paint2([["\u25C6 ", "crim"], ["setup: done", "bone"]])}
156248
+ ${commandFooter(columns)}`;
156249
+ }
156250
+
156251
+ // wallet/src/cli/shinjukuWallet.mjs
156117
156252
  init_consolePaste();
156118
156253
  init_homeJob();
156119
156254
 
@@ -157115,9 +157250,9 @@ async function curlOutput(response, values, deps, requestId) {
157115
157250
  }
157116
157251
  if (values.has("--include")) {
157117
157252
  const head = [`HTTP/1.1 ${response.status} ${response.statusText}`.trimEnd(), ...[...response.headers].map(([name, value2]) => `${name}: ${value2}`)];
157118
- io.out(`${head.join("\r\n")}\r
157253
+ io.out(Buffer.from(`${head.join("\r\n")}\r
157119
157254
  \r
157120
- `);
157255
+ `));
157121
157256
  }
157122
157257
  io.out(bytes2);
157123
157258
  }
@@ -159792,7 +159927,7 @@ async function runSetupCommand(values, deps) {
159792
159927
  return void 0;
159793
159928
  }
159794
159929
  const introduced = values.has("--yes") && inProxiedRun(deps.env);
159795
- const asksOwnFirst = interactive && Boolean(old) && terminal && !ownAddress;
159930
+ const asksOwnFirst = interactive && Boolean(old) && terminal && !ownAddress && !values.has("--add-to");
159796
159931
  io.out([
159797
159932
  ...introduced ? [] : [
159798
159933
  // S2 (a live check on the published 0.3.99): the help's words (shortHelpText), not "x402 URLs".
@@ -159803,8 +159938,12 @@ async function runSetupCommand(values, deps) {
159803
159938
  ` npx -y --no-audit --no-fund ${npxPackageWord(npmVersion)} mcp`,
159804
159939
  ""
159805
159940
  ],
159806
- old ? `Status: ${missing.includes("pool-retired") ? `set up before for a retired pool: ${retiredPoolText(old.pool, npmVersion).split("; run ")[0]}. This run moves config.json to the new pool and makes its wallet` : missing.length ? `set up before; missing now: ${missing.join(", ")}` : asksOwnFirst ? "set up" : "set up; every piece is checked again"} (home ${home}).` : `Home: ${home}`,
159807
- ""
159941
+ // The status line too, when a terminal setup started this run and printed it (AB234's live run 2026-11-04 showed
159942
+ // "Home:" and "Status:" twice); a script's own --yes run behind Tor keeps it.
159943
+ ...introduced && deps.env[SETUP_NEXT_BY_PARENT_ENV] === "1" ? [] : [
159944
+ old ? `Status: ${missing.includes("pool-retired") ? `set up before for a retired pool: ${retiredPoolText(old.pool, npmVersion).split("; run ")[0]}. This run moves config.json to the new pool and makes its wallet` : missing.length ? `set up before; missing now: ${missing.join(", ")}` : asksOwnFirst ? "set up" : "set up; every piece is checked again"} (home ${home}).` : `Home: ${home}`,
159945
+ ""
159946
+ ]
159808
159947
  ].join("\n"));
159809
159948
  const options = {
159810
159949
  home,
@@ -159829,7 +159968,8 @@ async function runSetupCommand(values, deps) {
159829
159968
  noLimitNote = true;
159830
159969
  }
159831
159970
  if (!values.has("--prefer-tor") && !torRunRecords) {
159832
- const tor = String(await deps.ask("Send every request through Tor? It hides your IP address; if Tor is not running, setup gives the one command that starts it. [Y/n] ")).trim();
159971
+ const torHow = (deps.platform ?? process.platform) === "win32" ? "the wallet gets Tor and runs it in the background for you (only if that fails, setup gives a command)" : "if Tor is not running, setup gives the one command that starts it";
159972
+ const tor = String(await deps.ask(`Send every request through Tor? It hides your IP address; ${torHow}. [Y/n] `)).trim();
159833
159973
  options.tor = !/^n(o)?$/i.test(tor);
159834
159974
  }
159835
159975
  if (!ownAddress && terminal) ownAddress = await askOwnAddress(deps);
@@ -160041,7 +160181,7 @@ async function fillAddFunds(values, deps) {
160041
160181
  throw new UsageError("add-funds needs the amount of USDC (--amount, from 0.01) when it runs without a terminal; in a terminal it asks", command);
160042
160182
  }
160043
160183
  if (terminal) {
160044
- const question = kept3 ? `How much USDC do you want to add? (from 0.01 USDC; Enter keeps ${usdcText4(kept3)} USDC): ` : "How much USDC do you want to add? (from 0.01 USDC): ";
160184
+ const question = kept3 ? `How much USDC do you want to add? (from 0.01 USDC; Enter keeps ${usdcText4(kept3)} USDC): ` : "How much USDC do you want to add? (from 0.01 USDC; Enter = stop): ";
160045
160185
  let atomic4;
160046
160186
  let done = false;
160047
160187
  for (let attempt = 0; attempt < 3 && !done; attempt += 1) {
@@ -160050,6 +160190,7 @@ async function fillAddFunds(values, deps) {
160050
160190
  done = true;
160051
160191
  break;
160052
160192
  }
160193
+ if (!answer) throw new AnswerDeclined("add_funds_stopped", "no amount was typed, so nothing was started; nothing was sent or paid");
160053
160194
  const read = usdcToAtomic(answer);
160054
160195
  if (!read || BigInt(read) < PAY_ME_MIN_ATOMIC) {
160055
160196
  deps.io.err(read ? "The smallest amount is 0.01 USDC. Type an amount like 2 or 0.05.\n" : "That is not an amount of USDC. Type an amount like 2 or 0.05.\n");
@@ -160954,7 +161095,7 @@ var COMMANDS = [
160954
161095
  ],
160955
161096
  notes: [
160956
161097
  `npx -y --no-audit --no-fund ${NPX_AT_VERSION} setup runs the same command. Without --yes a first setup asks in the terminal: Tor and your own wallet address (Enter skips it). A rerun in a terminal asks only for your own wallet address: on a complete setup an address given there is saved and nothing else runs; Enter checks every piece again.`,
160957
- `When Tor is recorded or asked for (a yes to the Tor question, --tor, --prefer-tor, or --private-inference), setup itself runs behind Tor: the release, the setup file downloads, and the RPC requests go over Tor, so Shinjuku never sees this machine's IP address make the wallet. config.json then records Tor for mcp ("tor": true), so the MCP runs behind Tor too. Tor must run first (if it does not, setup gives the one command that starts it); --no-tor runs it without Tor.`,
161098
+ `When Tor is recorded or asked for (a yes to the Tor question, --tor, --prefer-tor, or --private-inference), setup itself runs behind Tor: the release, the setup file downloads, and the RPC requests go over Tor, so Shinjuku never sees this machine's IP address make the wallet. config.json then records Tor for mcp ("tor": true), so the MCP runs behind Tor too. On Windows the wallet gets Tor and runs it in the background by itself (only if that fails, setup gives a command); on Linux and macOS Tor must run first (if it does not, setup gives the one command that starts it); --no-tor runs it without Tor.`,
160958
161099
  `Private inference (--private-inference): ${PRIVATE_INFERENCE_WHY} Setup records Tor. At the end, a terminal setup first offers to run add-funds (a --yes run prints ${CLI_WORD} add-funds), then prints ${CLI_WORD} chat (a private AI chat in this terminal), ${CLI_WORD} infer start (the local AI server in the background; it prints base_url and the api key when it starts), and the lines that add the wallet to an agent app. Setup never pays an inference call.`,
160959
161100
  "The wallet home is SHIELDED_WALLET_HOME, default " + defaultHomeWords() + " (every command of this CLI uses it). setup writes there: config.json, passphrase.txt (mode 0600; on Windows an access list for only you on this computer), the wallet (<pool>/wallet.json, made by init with the production pool, program, network, and USDC), a recovery file recovery-<time>.txt, and the setup files in proof-tools/<dir>/.",
160960
161101
  "The passphrase is never printed and no MCP tool takes or returns it. The recovery file holds the seed and the key: copy it to two offline places, then delete it from this machine.",
@@ -161828,6 +161969,10 @@ function parseFlags(command, args) {
161828
161969
  for (let index = 0; index < args.length; index += 1) {
161829
161970
  const token = args[index];
161830
161971
  if (!token.startsWith("--")) {
161972
+ if (command?.name === "pay" && /^https?:\/\//i.test(token)) {
161973
+ throw new UsageError(`pay takes its link after --url. To pay a link the simple way, run:
161974
+ ${cli4()} curl <the link>`);
161975
+ }
161831
161976
  const example = known.has("--amount") ? "--amount 0.5" : `--pool ${GUIDE.pool}`;
161832
161977
  throw new UsageError(`unexpected argument ${index + 1} (it has no flag in front of it): every value follows its flag, like ${example}`, command);
161833
161978
  }
@@ -164957,6 +165102,53 @@ var HOME_JOB_TITLES = {
164957
165102
  s: "set up the wallet",
164958
165103
  r: "restore your wallet"
164959
165104
  };
165105
+ var COMMAND_TITLES = {
165106
+ setup: "set up the wallet",
165107
+ balance: "private balance",
165108
+ "add-funds": "add funds",
165109
+ unshield: "send money out",
165110
+ curl: "pay a link",
165111
+ pay: "pay",
165112
+ infer: "private AI",
165113
+ backup: "save a backup",
165114
+ limits: "spending limits",
165115
+ restore: "restore your wallet",
165116
+ receive: "receive",
165117
+ tor: "tor",
165118
+ help: "help",
165119
+ "--help": "help",
165120
+ "-h": "help",
165121
+ version: "version",
165122
+ "--version": "version",
165123
+ "-v": "version"
165124
+ };
165125
+ var UNTHEMED_COMMANDS = /* @__PURE__ */ new Set(["mcp", "chat"]);
165126
+ var themedCommand = (name, args) => name !== void 0 && !UNTHEMED_COMMANDS.has(name) && !args.includes("--json") && !(name === "infer" && !["start", "status", "stop"].includes(args[0]));
165127
+ var DATA_STDOUT_COMMANDS = /* @__PURE__ */ new Set(["curl", "pay"]);
165128
+ var designStream = (name) => DATA_STDOUT_COMMANDS.has(name) ? process.stderr : process.stdout;
165129
+ function commandTitle(name, args) {
165130
+ const known = (word) => COMMAND_BY_NAME.has(word) || FAMILIES.has(word);
165131
+ const help = name === "help" || name === "--help" || name === "-h";
165132
+ return help ? known(args[0]) ? `help: ${args[0]}` : "help" : COMMAND_TITLES[name] ?? (known(name) ? name : "help");
165133
+ }
165134
+ function entryTheme(argv2, env = process.env) {
165135
+ const [name, ...args] = withoutConnectionFlags(argv2);
165136
+ const plain = { err: (text3) => process.stderr.write(text3), end: () => {
165137
+ } };
165138
+ const stream = designStream(name);
165139
+ if (!terminalThemeOn({ stdout: stream, env })) return plain;
165140
+ const paint2 = setupPainter({ stdout: stream, env });
165141
+ const err = (text3) => process.stderr.write(paintChunk(text3, paint2));
165142
+ if (name === "chat") return { err, end: () => {
165143
+ } };
165144
+ if (!themedCommand(name, args)) return plain;
165145
+ const top = env[THEME_CHILD_ENV] !== "1" && env[HOME_JOB_ENV] !== "1" && !(name === "setup" && !args.includes("--yes"));
165146
+ if (!top) return { err, end: () => {
165147
+ } };
165148
+ stream.write(commandHeader(stream.columns, commandTitle(name, args), { stream, env }));
165149
+ env[THEME_CHILD_ENV] = "1";
165150
+ return { err, end: () => stream.write(commandFooter(stream.columns, { stream, env })) };
165151
+ }
164960
165152
  async function homeKeyJob(key, { data, argv: argv2, deps }) {
164961
165153
  const io = deps.io;
164962
165154
  const child = (words2) => deps.runHomeChild([...words2, ...argv2], deps.env);
@@ -165031,6 +165223,87 @@ ${HOST_TARGETS.map((host, index) => ` ${index + 1} ${hostNames[host] ?? host}`
165031
165223
  return 130;
165032
165224
  }
165033
165225
  }
165226
+ function setupThemeFor(values, deps) {
165227
+ if (!setupThemeOn({ env: deps.env, interactive: !values.has("--yes"), stdinIsTTY: deps.stdinIsTTY() })) return void 0;
165228
+ const paint2 = setupPainter({ env: deps.env });
165229
+ const top = !values.has("--yes") && deps.env[SETUP_THEME_ENV] !== "1" && deps.env[HOME_JOB_ENV] !== "1";
165230
+ if (top) {
165231
+ deps.io.out(setupHeader(paint2, process.stdout.columns));
165232
+ deps.env[SETUP_THEME_ENV] = "1";
165233
+ }
165234
+ return { io: themedIo(deps.io, paint2), ask: themedAsk(deps.ask, paint2), paint: paint2, top };
165235
+ }
165236
+ async function openShinjukuAfterSetup(argv2, deps, theme2) {
165237
+ delete deps.env[SETUP_THEME_ENV];
165238
+ deps.io.out(setupFooter(theme2.paint, process.stdout.columns));
165239
+ let answer;
165240
+ try {
165241
+ answer = String(await theme2.ask("Open Shinjuku now? (Enter = yes) ")).trim();
165242
+ } catch (error) {
165243
+ if (!(error instanceof QuestionCancelled)) throw error;
165244
+ answer = "n";
165245
+ theme2.io.out("\n");
165246
+ }
165247
+ if (/^n(o)?$/i.test(answer)) {
165248
+ theme2.io.out(`To open Shinjuku later, type:
165249
+ ${cli4()}
165250
+ `);
165251
+ return 0;
165252
+ }
165253
+ const connection = argv2.flatMap((word, index) => word === "--tor" || word === "--no-tor" ? [word] : word === "--proxy" && argv2[index + 1] ? [word, argv2[index + 1]] : []);
165254
+ return runHomeLoop(connection, deps, { animation: false });
165255
+ }
165256
+ async function runHomeLoop(argv2, deps, { animation = true } = {}) {
165257
+ const io = deps.io;
165258
+ if (!deps.homeScreenOn(deps.env)) {
165259
+ const room = deps.stdinIsTTY() && process.stdout.isTTY ? await deps.homeWaitForRoom(deps.env) : "off";
165260
+ if (room === "quit") return 0;
165261
+ if (room !== "room") {
165262
+ io.out(shortHelpText());
165263
+ return 0;
165264
+ }
165265
+ }
165266
+ const readData = () => ({
165267
+ ...deps.homeData({ env: deps.env, walletVersion: deps.walletVersion, torRun: homeJobTor(argv2, deps.env) }),
165268
+ ...deps.homeKeysExtra(deps.env)
165269
+ });
165270
+ if (animation) {
165271
+ const played = await deps.openAnimation();
165272
+ bareAnimationPlayed = true;
165273
+ if (played === "interrupted") return 130;
165274
+ }
165275
+ let ranJob = false;
165276
+ const clearAfterJobs = () => {
165277
+ if (ranJob && process.stdout.isTTY) io.out("\x1B[0m\x1B[2J\x1B[H");
165278
+ };
165279
+ for (; ; ) {
165280
+ const data = readData();
165281
+ const balanceRead = homeBalanceRead(data, argv2, deps, readData);
165282
+ const screen = await deps.homeScreen(balanceRead ? balanceRead.data() : data, deps.env, balanceRead?.watch);
165283
+ if (screen.outcome === "interrupted") {
165284
+ clearAfterJobs();
165285
+ return 130;
165286
+ }
165287
+ if (screen.outcome === "quit") {
165288
+ clearAfterJobs();
165289
+ return 0;
165290
+ }
165291
+ if (screen.outcome !== "key") {
165292
+ const room = !deps.homeScreenOn(deps.env) && deps.stdinIsTTY() && process.stdout.isTTY ? await deps.homeWaitForRoom(deps.env) : "off";
165293
+ if (room === "room") continue;
165294
+ if (room === "quit") {
165295
+ clearAfterJobs();
165296
+ return 0;
165297
+ }
165298
+ io.out(shortHelpText());
165299
+ return 0;
165300
+ }
165301
+ await balanceRead?.finish(io);
165302
+ ranJob = true;
165303
+ const view2 = await deps.homeJobView(HOME_JOB_TITLES[screen.key] ?? "wallet", () => homeKeyJob(screen.key, { data, argv: argv2, deps }));
165304
+ if (view2.next === "quit") return view2.code === 130 ? 130 : 0;
165305
+ }
165306
+ }
165034
165307
  async function runShinjukuWallet(argv2, overrides = {}) {
165035
165308
  const deps = { ...defaultDependencies(), ...overrides };
165036
165309
  if (overrides.runClaudeCli && !overrides.runClaudeCliQuiet) deps.runClaudeCliQuiet = overrides.runClaudeCli;
@@ -165041,6 +165314,28 @@ async function runShinjukuWallet(argv2, overrides = {}) {
165041
165314
  markTorRunStarted(deps.env);
165042
165315
  const { io } = deps;
165043
165316
  const [name, ...args] = isHelpRequest(argv2) ? withoutConnectionFlags(argv2) : argv2;
165317
+ const stream = designStream(name);
165318
+ const dataOut = stream === process.stderr;
165319
+ const themed = endsProcess && themedCommand(name, args) && terminalThemeOn({ stdout: stream, env: deps.env });
165320
+ const unTheme = themed ? themeStreams(setupPainter({ stdout: stream, env: deps.env }), dataOut ? [process.stderr] : void 0) : () => {
165321
+ };
165322
+ const designOut = dataOut ? io.err : io.out;
165323
+ const topRun = themed && deps.env[THEME_CHILD_ENV] !== "1" && deps.env[HOME_JOB_ENV] !== "1";
165324
+ const ownTop = topRun && !(name === "setup" && !args.includes("--yes"));
165325
+ if (ownTop) designOut(commandHeader(stream.columns, commandTitle(name, args), { stream, env: deps.env }));
165326
+ if (themed) {
165327
+ deps.env[THEME_CHILD_ENV] = "1";
165328
+ if (typeof deps.ask === "function") deps.ask = themedAsk(deps.ask, setupPainter({ env: deps.env }));
165329
+ }
165330
+ try {
165331
+ return await runCommandLine(argv2, deps, { name, args, endsProcess });
165332
+ } finally {
165333
+ if (ownTop) designOut(commandFooter(stream.columns, { stream, env: deps.env }));
165334
+ unTheme();
165335
+ }
165336
+ }
165337
+ async function runCommandLine(argv2, deps, { name, args, endsProcess }) {
165338
+ const { io } = deps;
165044
165339
  let command;
165045
165340
  let values;
165046
165341
  let showProgressAgain = () => {
@@ -165061,46 +165356,7 @@ async function runShinjukuWallet(argv2, overrides = {}) {
165061
165356
  }
165062
165357
  if (name === void 0 || name === "help" || name === "--help" || name === "-h") {
165063
165358
  if (name === void 0) {
165064
- if (!deps.homeScreenOn(deps.env)) {
165065
- const room = deps.stdinIsTTY() && process.stdout.isTTY ? await deps.homeWaitForRoom(deps.env) : "off";
165066
- if (room === "quit") return 0;
165067
- if (room !== "room") {
165068
- io.out(shortHelpText());
165069
- return 0;
165070
- }
165071
- }
165072
- const readData = () => ({
165073
- ...deps.homeData({ env: deps.env, walletVersion: deps.walletVersion, torRun: homeJobTor(argv2, deps.env) }),
165074
- ...deps.homeKeysExtra(deps.env)
165075
- });
165076
- const played = await deps.openAnimation();
165077
- bareAnimationPlayed = true;
165078
- if (played === "interrupted") return 130;
165079
- let ranJob = false;
165080
- const clearAfterJobs = () => {
165081
- if (ranJob && process.stdout.isTTY) io.out("\x1B[0m\x1B[2J\x1B[H");
165082
- };
165083
- for (; ; ) {
165084
- const data = readData();
165085
- const balanceRead = homeBalanceRead(data, argv2, deps, readData);
165086
- const screen = await deps.homeScreen(balanceRead ? balanceRead.data() : data, deps.env, balanceRead?.watch);
165087
- if (screen.outcome === "interrupted") {
165088
- clearAfterJobs();
165089
- return 130;
165090
- }
165091
- if (screen.outcome === "quit") {
165092
- clearAfterJobs();
165093
- return 0;
165094
- }
165095
- if (screen.outcome !== "key") {
165096
- io.out(shortHelpText());
165097
- return 0;
165098
- }
165099
- await balanceRead?.finish(io);
165100
- ranJob = true;
165101
- const view2 = await deps.homeJobView(HOME_JOB_TITLES[screen.key] ?? "wallet", () => homeKeyJob(screen.key, { data, argv: argv2, deps }));
165102
- if (view2.next === "quit") return view2.code === 130 ? 130 : 0;
165103
- }
165359
+ return runHomeLoop(argv2, deps);
165104
165360
  }
165105
165361
  if (args.length === 0 || args.length === 1 && args[0] === "help") {
165106
165362
  io.out(shortHelpText());
@@ -165212,17 +165468,20 @@ This copy: ${walletVersionLine(deps.walletVersion())}
165212
165468
  connect: () => (deps.connectRpc ?? connect2)(familyRpcUrl(), "finalized", { timeoutMs: 15e3 })
165213
165469
  });
165214
165470
  if (!besideStart && familyRoots !== void 0) await familyRoots;
165215
- const commandDeps = besideStart && familyRoots !== void 0 ? { ...runDeps, familyRootsReady: familyRoots } : runDeps;
165471
+ let commandDeps = besideStart && familyRoots !== void 0 ? { ...runDeps, familyRootsReady: familyRoots } : runDeps;
165472
+ const theme2 = command.name === "setup" ? setupThemeFor(values, runDeps) : void 0;
165473
+ if (theme2) commandDeps = { ...commandDeps, io: theme2.io, ask: theme2.ask };
165216
165474
  const restorePassphrase = lendPassphrase(defaults.passphrase);
165217
165475
  try {
165218
- await command.run(rpc.args, values, rpc.url === void 0 ? commandDeps : { ...commandDeps, rpcUrlFromFile: rpc.url }, io);
165476
+ await command.run(rpc.args, values, rpc.url === void 0 ? commandDeps : { ...commandDeps, rpcUrlFromFile: rpc.url }, theme2?.io ?? io);
165219
165477
  } finally {
165220
165478
  restorePassphrase();
165221
165479
  }
165222
165480
  const innerSetup = command.name === "setup" && inProxiedRun(runDeps.env);
165223
- if (!command.nextInOutput && !innerSetup && !values.has(RAN_BEHIND_TOR)) io.err(`${command.nextLabel ?? "Next"}: ${hintForThisRun(helpVersionWords(command.nextAfterRun?.(values, deps) ?? command.next, deps.walletVersion().npm), values)}
165481
+ if (!command.nextInOutput && !innerSetup && !values.has(RAN_BEHIND_TOR)) (theme2?.io ?? io).err(`${command.nextLabel ?? "Next"}: ${hintForThisRun(helpVersionWords(command.nextAfterRun?.(values, deps) ?? command.next, deps.walletVersion().npm), values)}
165224
165482
  `);
165225
165483
  writeRunResult(deps, command, 0);
165484
+ if (theme2?.top) return await openShinjukuAfterSetup(argv2, deps, theme2);
165226
165485
  return 0;
165227
165486
  } catch (error) {
165228
165487
  if (endsProcess) showProgressAgain = () => {
@@ -165380,7 +165639,9 @@ var entryArgv = runNetworkMode() === null ? torArgv(argv) : argv;
165380
165639
  var wrapper = runNetworkMode() === null && (entryArgv.includes("--tor") || entryArgv.includes("--proxy"));
165381
165640
  var stopSetupWatch = process.env[KEEP_WARM_ONCE_PARENT_ENV] === "1" && !wrapper ? watchSetupParentPipe() : void 0;
165382
165641
  var mcpRefused = async (options) => (await Promise.resolve().then(() => (init_torMissingMcp(), torMissingMcp_exports))).serveTorMissingMcp(options);
165383
- var code = isHelpRequest(argv) ? await runShinjukuWallet(argv) : await proxyEntry(entryArgv, runShinjukuWallet, { mcpRefused });
165642
+ var theme = isHelpRequest(argv) ? void 0 : entryTheme(entryArgv);
165643
+ var code = isHelpRequest(argv) ? await runShinjukuWallet(argv) : await proxyEntry(entryArgv, runShinjukuWallet, { mcpRefused, ...theme ? { err: theme.err } : {} });
165644
+ theme?.end();
165384
165645
  stopSetupWatch?.();
165385
165646
  process.exitCode = code;
165386
165647
  setTimeout(() => process.exit(code), mcpServerEndedHere() ? 0 : 2e3).unref();