shinjuku-shielded 0.3.161 → 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.161. 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.161
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.161 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.161 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.161", "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.161", "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": "9bbc535c39d7f3ca35992be853e343d8374075618e0130ef2ab4f526a300b091",
5
- "bytes": 9260169,
6
- "sourceCommit": "157e988ee5f4ca6c609f49b296feabd64217eba7",
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-04T06:13:30.270Z"
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.161",
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": "9bbc535c",
7
- "shinjukuSha256": "9bbc535c39d7f3ca35992be853e343d8374075618e0130ef2ab4f526a300b091",
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",
@@ -110076,13 +110076,14 @@ function refusalSay(a, tool, again, npmVersion) {
110076
110076
  ].find((line) => words(line) <= SAY_MAX_WORDS) ?? `Not known yet if ${seller} kept ${what}. Nothing to do now.`;
110077
110077
  }
110078
110078
  if (code2 === "p03_resource_paid_seller_failed") {
110079
- const failed = Number.isInteger(a.httpStatus) ? `${seller}'s service failed (HTTP ${a.httpStatus})` : `${seller}'s service failed`;
110080
- const paid = total ? `Paid ${total} USDC` : "Paid";
110081
- return [
110082
- `${paid}, but ${failed} after it took the payment. Do not pay again now; try later, or ask ${seller}'s support.`,
110083
- `${paid}, but ${failed}. Do not pay again now; try later, or ask ${seller}.`,
110084
- `${paid}, but ${failed}. Do not pay again now.`
110085
- ].find((line) => words(line) <= SAY_MAX_WORDS) ?? `${paid}, but ${failed}. Do not pay again now.`;
110079
+ const tx = typeof a.transaction === "string" && /^[1-9A-HJ-NP-Za-km-z]{43,90}$/.test(a.transaction) ? a.transaction : void 0;
110080
+ const head = (status) => `${total ? `Paid ${total} USDC` : "Paid"}; ${seller} got paid, but its service failed${status}.`;
110081
+ const statuses = [...Number.isInteger(a.httpStatus) ? [` (HTTP ${a.httpStatus})`] : [], ""];
110082
+ return firstFit(
110083
+ ...tx ? statuses.map((s3) => `${head(s3)} Shinjuku refunds nothing. Do not pay again; ask its support, giving transaction ${tx}.`) : [],
110084
+ ...statuses.map((s3) => `${head(s3)} No refund comes from Shinjuku. Do not pay again; ask its support.`),
110085
+ `${head("")} Shinjuku refunds nothing. Do not pay again.`
110086
+ );
110086
110087
  }
110087
110088
  if (code2 === "p03_float_transfer_expired") {
110088
110089
  const status = Number.isInteger(a.httpStatus);
@@ -146621,9 +146622,12 @@ async function openHomeScreen({ stdout = process.stdout, stdin = process.stdin,
146621
146622
  if (view2) screenText(view2.screen, codes).forEach((line, y) => {
146622
146623
  if (line) out += `\x1B[${y + 1};1H${line}`;
146623
146624
  });
146624
- else TOO_SMALL.forEach((line, y) => {
146625
- out += `\x1B[${y + 1};1H${fit(line, columns - 1)}`;
146626
- });
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
+ }
146627
146631
  write(`${out}\x1B[?2026l`);
146628
146632
  };
146629
146633
  const spin = () => {
@@ -146775,8 +146779,13 @@ async function waitForRoom({ stdout = process.stdout, stdin = process.stdin, env
146775
146779
  } catch {
146776
146780
  }
146777
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
+ })();
146778
146786
  const say3 = () => write([
146779
146787
  "\x1B[0m\x1B[2J\x1B[H",
146788
+ mark,
146780
146789
  "This window is too small for the wallet screen.",
146781
146790
  `It needs ${needs.columns} x ${needs.rows}; this one is ${stdout.columns} x ${stdout.rows}.`,
146782
146791
  "Make the window larger: the screen opens by itself.",
@@ -146815,7 +146824,7 @@ async function waitForRoom({ stdout = process.stdout, stdin = process.stdin, env
146815
146824
  }
146816
146825
  }
146817
146826
  }
146818
- 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;
146819
146828
  var init_homeScreen = __esm({
146820
146829
  "wallet/src/cli/homeScreen.mjs"() {
146821
146830
  "use strict";
@@ -146879,7 +146888,16 @@ var init_homeScreen = __esm({
146879
146888
  END_KEYS = [HELP_KEY, QUIT_KEY];
146880
146889
  RESTORE_STEP = "or press r to restore it from your recovery file in a new folder.";
146881
146890
  HINT = "? help \xB7 q quit";
146882
- 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
+ };
146883
146901
  COLORS = {
146884
146902
  crim: "#D4202A",
146885
146903
  crimdim: "#6E0A11",
@@ -147056,6 +147074,27 @@ function chatHeaderLines({ color, columns, version: version3, model: model2, row
147056
147074
  for (const [label, parts] of rows2) lines.push(paint([[" ", ""], [label.padEnd(12), "dim"], ...parts], color));
147057
147075
  return lines;
147058
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
+ }
147059
147098
  function chatEndLines({ color, columns }) {
147060
147099
  if (!color || !(columns >= HEADER_COLUMNS)) return [];
147061
147100
  const statements = [...STATEMENTS].map((ch) => [ch, ch === "." ? "verm" : "bone"]);
@@ -156113,6 +156152,103 @@ async function playOpenAnimation({ stdout = process.stdout, stdin = process.stdi
156113
156152
 
156114
156153
  // wallet/src/cli/shinjukuWallet.mjs
156115
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
156116
156252
  init_consolePaste();
156117
156253
  init_homeJob();
156118
156254
 
@@ -157114,9 +157250,9 @@ async function curlOutput(response, values, deps, requestId) {
157114
157250
  }
157115
157251
  if (values.has("--include")) {
157116
157252
  const head = [`HTTP/1.1 ${response.status} ${response.statusText}`.trimEnd(), ...[...response.headers].map(([name, value2]) => `${name}: ${value2}`)];
157117
- io.out(`${head.join("\r\n")}\r
157253
+ io.out(Buffer.from(`${head.join("\r\n")}\r
157118
157254
  \r
157119
- `);
157255
+ `));
157120
157256
  }
157121
157257
  io.out(bytes2);
157122
157258
  }
@@ -159791,7 +159927,7 @@ async function runSetupCommand(values, deps) {
159791
159927
  return void 0;
159792
159928
  }
159793
159929
  const introduced = values.has("--yes") && inProxiedRun(deps.env);
159794
- const asksOwnFirst = interactive && Boolean(old) && terminal && !ownAddress;
159930
+ const asksOwnFirst = interactive && Boolean(old) && terminal && !ownAddress && !values.has("--add-to");
159795
159931
  io.out([
159796
159932
  ...introduced ? [] : [
159797
159933
  // S2 (a live check on the published 0.3.99): the help's words (shortHelpText), not "x402 URLs".
@@ -159802,8 +159938,12 @@ async function runSetupCommand(values, deps) {
159802
159938
  ` npx -y --no-audit --no-fund ${npxPackageWord(npmVersion)} mcp`,
159803
159939
  ""
159804
159940
  ],
159805
- 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}`,
159806
- ""
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
+ ]
159807
159947
  ].join("\n"));
159808
159948
  const options = {
159809
159949
  home,
@@ -159828,7 +159968,8 @@ async function runSetupCommand(values, deps) {
159828
159968
  noLimitNote = true;
159829
159969
  }
159830
159970
  if (!values.has("--prefer-tor") && !torRunRecords) {
159831
- 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();
159832
159973
  options.tor = !/^n(o)?$/i.test(tor);
159833
159974
  }
159834
159975
  if (!ownAddress && terminal) ownAddress = await askOwnAddress(deps);
@@ -160040,7 +160181,7 @@ async function fillAddFunds(values, deps) {
160040
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);
160041
160182
  }
160042
160183
  if (terminal) {
160043
- 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): ";
160044
160185
  let atomic4;
160045
160186
  let done = false;
160046
160187
  for (let attempt = 0; attempt < 3 && !done; attempt += 1) {
@@ -160049,6 +160190,7 @@ async function fillAddFunds(values, deps) {
160049
160190
  done = true;
160050
160191
  break;
160051
160192
  }
160193
+ if (!answer) throw new AnswerDeclined("add_funds_stopped", "no amount was typed, so nothing was started; nothing was sent or paid");
160052
160194
  const read = usdcToAtomic(answer);
160053
160195
  if (!read || BigInt(read) < PAY_ME_MIN_ATOMIC) {
160054
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");
@@ -160953,7 +161095,7 @@ var COMMANDS = [
160953
161095
  ],
160954
161096
  notes: [
160955
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.`,
160956
- `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.`,
160957
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.`,
160958
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>/.",
160959
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.",
@@ -161827,6 +161969,10 @@ function parseFlags(command, args) {
161827
161969
  for (let index = 0; index < args.length; index += 1) {
161828
161970
  const token = args[index];
161829
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
+ }
161830
161976
  const example = known.has("--amount") ? "--amount 0.5" : `--pool ${GUIDE.pool}`;
161831
161977
  throw new UsageError(`unexpected argument ${index + 1} (it has no flag in front of it): every value follows its flag, like ${example}`, command);
161832
161978
  }
@@ -164956,6 +165102,53 @@ var HOME_JOB_TITLES = {
164956
165102
  s: "set up the wallet",
164957
165103
  r: "restore your wallet"
164958
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
+ }
164959
165152
  async function homeKeyJob(key, { data, argv: argv2, deps }) {
164960
165153
  const io = deps.io;
164961
165154
  const child = (words2) => deps.runHomeChild([...words2, ...argv2], deps.env);
@@ -165030,6 +165223,87 @@ ${HOST_TARGETS.map((host, index) => ` ${index + 1} ${hostNames[host] ?? host}`
165030
165223
  return 130;
165031
165224
  }
165032
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
+ }
165033
165307
  async function runShinjukuWallet(argv2, overrides = {}) {
165034
165308
  const deps = { ...defaultDependencies(), ...overrides };
165035
165309
  if (overrides.runClaudeCli && !overrides.runClaudeCliQuiet) deps.runClaudeCliQuiet = overrides.runClaudeCli;
@@ -165040,6 +165314,28 @@ async function runShinjukuWallet(argv2, overrides = {}) {
165040
165314
  markTorRunStarted(deps.env);
165041
165315
  const { io } = deps;
165042
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;
165043
165339
  let command;
165044
165340
  let values;
165045
165341
  let showProgressAgain = () => {
@@ -165060,46 +165356,7 @@ async function runShinjukuWallet(argv2, overrides = {}) {
165060
165356
  }
165061
165357
  if (name === void 0 || name === "help" || name === "--help" || name === "-h") {
165062
165358
  if (name === void 0) {
165063
- if (!deps.homeScreenOn(deps.env)) {
165064
- const room = deps.stdinIsTTY() && process.stdout.isTTY ? await deps.homeWaitForRoom(deps.env) : "off";
165065
- if (room === "quit") return 0;
165066
- if (room !== "room") {
165067
- io.out(shortHelpText());
165068
- return 0;
165069
- }
165070
- }
165071
- const readData = () => ({
165072
- ...deps.homeData({ env: deps.env, walletVersion: deps.walletVersion, torRun: homeJobTor(argv2, deps.env) }),
165073
- ...deps.homeKeysExtra(deps.env)
165074
- });
165075
- const played = await deps.openAnimation();
165076
- bareAnimationPlayed = true;
165077
- if (played === "interrupted") return 130;
165078
- let ranJob = false;
165079
- const clearAfterJobs = () => {
165080
- if (ranJob && process.stdout.isTTY) io.out("\x1B[0m\x1B[2J\x1B[H");
165081
- };
165082
- for (; ; ) {
165083
- const data = readData();
165084
- const balanceRead = homeBalanceRead(data, argv2, deps, readData);
165085
- const screen = await deps.homeScreen(balanceRead ? balanceRead.data() : data, deps.env, balanceRead?.watch);
165086
- if (screen.outcome === "interrupted") {
165087
- clearAfterJobs();
165088
- return 130;
165089
- }
165090
- if (screen.outcome === "quit") {
165091
- clearAfterJobs();
165092
- return 0;
165093
- }
165094
- if (screen.outcome !== "key") {
165095
- io.out(shortHelpText());
165096
- return 0;
165097
- }
165098
- await balanceRead?.finish(io);
165099
- ranJob = true;
165100
- const view2 = await deps.homeJobView(HOME_JOB_TITLES[screen.key] ?? "wallet", () => homeKeyJob(screen.key, { data, argv: argv2, deps }));
165101
- if (view2.next === "quit") return view2.code === 130 ? 130 : 0;
165102
- }
165359
+ return runHomeLoop(argv2, deps);
165103
165360
  }
165104
165361
  if (args.length === 0 || args.length === 1 && args[0] === "help") {
165105
165362
  io.out(shortHelpText());
@@ -165211,17 +165468,20 @@ This copy: ${walletVersionLine(deps.walletVersion())}
165211
165468
  connect: () => (deps.connectRpc ?? connect2)(familyRpcUrl(), "finalized", { timeoutMs: 15e3 })
165212
165469
  });
165213
165470
  if (!besideStart && familyRoots !== void 0) await familyRoots;
165214
- 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 };
165215
165474
  const restorePassphrase = lendPassphrase(defaults.passphrase);
165216
165475
  try {
165217
- 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);
165218
165477
  } finally {
165219
165478
  restorePassphrase();
165220
165479
  }
165221
165480
  const innerSetup = command.name === "setup" && inProxiedRun(runDeps.env);
165222
- 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)}
165223
165482
  `);
165224
165483
  writeRunResult(deps, command, 0);
165484
+ if (theme2?.top) return await openShinjukuAfterSetup(argv2, deps, theme2);
165225
165485
  return 0;
165226
165486
  } catch (error) {
165227
165487
  if (endsProcess) showProgressAgain = () => {
@@ -165379,7 +165639,9 @@ var entryArgv = runNetworkMode() === null ? torArgv(argv) : argv;
165379
165639
  var wrapper = runNetworkMode() === null && (entryArgv.includes("--tor") || entryArgv.includes("--proxy"));
165380
165640
  var stopSetupWatch = process.env[KEEP_WARM_ONCE_PARENT_ENV] === "1" && !wrapper ? watchSetupParentPipe() : void 0;
165381
165641
  var mcpRefused = async (options) => (await Promise.resolve().then(() => (init_torMissingMcp(), torMissingMcp_exports))).serveTorMissingMcp(options);
165382
- 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();
165383
165645
  stopSetupWatch?.();
165384
165646
  process.exitCode = code;
165385
165647
  setTimeout(() => process.exit(code), mcpServerEndedHere() ? 0 : 2e3).unref();