shinjuku-shield 0.3.101 → 0.3.102

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.101. The npm packages `shinjuku-shield` and
9
+ This is version 0.3.102. 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 --no-audit --no-fund shinjuku-shield@0.3.101 setup
15
+ npx -y --no-audit --no-fund shinjuku-shield@0.3.102 setup
16
16
  ```
17
17
 
18
18
  Setup makes the wallet on this machine, a private passphrase file, and the
@@ -24,7 +24,7 @@ server to that host's config.
24
24
  ## The `shinjuku` command
25
25
 
26
26
  ```sh
27
- npm install -g --no-audit --no-fund shinjuku@0.3.101
27
+ npm install -g --no-audit --no-fund shinjuku@0.3.102
28
28
  shinjuku help
29
29
  ```
30
30
 
@@ -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.101 mcp
39
+ claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.102 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.101", "mcp"] } } }
45
+ { "mcpServers": { "shinjuku": { "command": "npx", "args": ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.102", "mcp"] } } }
46
46
  ```
47
47
 
48
48
  On native Windows, if the host cannot find `npx`, use `"command": "cmd"` and
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": "1c3d204e7ba114b9d80654035efb4a244ac607f038e1961f23663b7af9b45dc5",
5
- "bytes": 12794106,
6
- "sourceCommit": "9e761632116ec38e2adb92828c85cc1793b45c90",
4
+ "sha256": "3a9841626e4a97d756f610278b4e03f2571b556a7b06207c418a850b2b5200bf",
5
+ "bytes": 12797194,
6
+ "sourceCommit": "ca9b414196f12b2512f5457cb0160b58c8a36b25",
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",
@@ -1297,5 +1297,5 @@
1297
1297
  "version": "1.8.0"
1298
1298
  }
1299
1299
  ],
1300
- "publishedAt": "2026-10-24T13:59:01.418Z"
1300
+ "publishedAt": "2026-10-24T14:57:43.313Z"
1301
1301
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "shinjuku-shield",
3
- "version": "0.3.101",
3
+ "version": "0.3.102",
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": "1c3d204e",
7
- "shinjukuSha256": "1c3d204e7ba114b9d80654035efb4a244ac607f038e1961f23663b7af9b45dc5",
6
+ "shinjukuRelease": "3a984162",
7
+ "shinjukuSha256": "3a9841626e4a97d756f610278b4e03f2571b556a7b06207c418a850b2b5200bf",
8
8
  "license": "SEE LICENSE IN LICENSE.txt",
9
9
  "author": "Shinjuku Shielded",
10
10
  "homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
@@ -120441,7 +120441,7 @@ function paidMessage(error, code2, paid, requestId, key) {
120441
120441
  const floatId = error?.floatId ?? error?.cause?.floatId;
120442
120442
  const sellerSaid = error?.sellerReason ?? error?.cause?.sellerReason;
120443
120443
  const reason = code2 === "p03_float_seller_kept_payment" ? `The AI provider received the payment but did not serve the request${typeof sellerSaid === "string" ? ` (${JSON.stringify(sellerSaid)})` : ""}; no refund comes. ` : typeof sellerSaid === "string" ? `The AI provider refused the payment: ${JSON.stringify(sellerSaid)}. ` : "";
120444
- return `this call was paid ${usdcWords(paid)} and returned no answer${floatId ? ` (float ${floatId})` : ""}. Do not resend it without the same Idempotency-Key: a new request pays again. ${reason}Request id ${requestId}` + (key ? `; a resend with header Idempotency-Key: ${key} returns this same result and pays nothing more. ` : ". ") + (refund && ambiguous ? "An earlier send of it may have reached the seller; if it did not, Shinjuku refunds the amount in about 7 minutes. Check shinjuku balance" : refund ? "Shinjuku refunds the amount to the wallet by itself in about 7 minutes; shinjuku balance shows it back" : "Check the wallet with shinjuku balance");
120444
+ return `this call was paid ${usdcWords(paid)} and returned no answer${floatId ? ` (Shinjuku payment ${floatId})` : ""}. Do not resend it without the same Idempotency-Key: a new request pays again. ${reason}Request id ${requestId}` + (key ? `; a resend with header Idempotency-Key: ${key} returns this same result and pays nothing more. ` : ". ") + (refund && ambiguous ? "An earlier send of it may have reached the seller; if it did not, Shinjuku refunds the amount in about 7 minutes. Check shinjuku balance" : refund ? "Shinjuku refunds the amount to the wallet by itself in about 7 minutes; shinjuku balance shows it back" : "Check the wallet with shinjuku balance");
120445
120445
  }
120446
120446
  function unknownMessage(code2, counted, requestId, key) {
120447
120447
  return `request ${requestId} may already have paid (${code2 ?? "the payment failed with no code"}), and its outcome is not known yet. This server counted ${usdcWords(counted)} (its limit per request) of its limit per run for it. ` + (key ? `Do not send it as a new request: resend the same body with header Idempotency-Key: ${key} to finish that same payment; it never pays twice` : "This request had no Idempotency-Key, so infer serve cannot resume that payment, and a resend pays again. Check the wallet with shinjuku balance before you send it again, and send an Idempotency-Key header with each request so a resend finishes the same payment");
@@ -136463,6 +136463,11 @@ async function runChat({ io, values, deps = {} }) {
136463
136463
  say6(`No AI provider serves ${turn.model} at this price right now. ${paidWords} Try another model (/model ${models.find((entry) => entry.id !== turn.model)?.id ?? DEFAULT_MODEL2}), or ${again} later.`);
136464
136464
  } else if (NO_ANSWER_CODES.test(code2 ?? "")) {
136465
136465
  say6(`The AI provider did not send a chat answer. ${paidWords} Wait a moment and ${again}, or try another model (/model).`);
136466
+ } else if (FLOAT_WAIT_WORDS[code2]) {
136467
+ state.pending = turn;
136468
+ const named = error?.retryAfterSeconds ?? error?.cause?.retryAfterSeconds;
136469
+ const seconds2 = Number.isFinite(named) && named > 0 ? Math.ceil(named) : FLOAT_WAIT_WORDS[code2].seconds;
136470
+ say6(`Nothing was paid: ${FLOAT_WAIT_WORDS[code2].what}. Ask again in about ${seconds2 >= 60 ? `${Math.round(seconds2 / 60)} minute${seconds2 >= 120 ? "s" : ""}` : `${seconds2} seconds`} (or /retry).`);
136466
136471
  } else if (WAIT_CODES.test(code2 ?? "")) {
136467
136472
  say6(`The payment did not finish yet (the wallet or the network is busy). ${paidWords} Wait a moment, then ${again}.`);
136468
136473
  } else {
@@ -136548,7 +136553,7 @@ async function runChat({ io, values, deps = {} }) {
136548
136553
  await session.close();
136549
136554
  }
136550
136555
  }
136551
- var DEFAULT_MODEL2, CHAT_DEFAULT_MODEL, CHAT_MAX_TOKENS, CHAT_SHORT_TOKENS, DEFAULT_ANSWER_CAP_ATOMIC, DEFAULT_CHAT_CAP_ATOMIC, CHEAPEST_MODEL, STILL_WAITING_MS, providerKept, higherCap, POSITIVE_ATOMIC9, SHINJUKU_FEE_ATOMIC, SHORT_QUESTION_TOKENS, PASTE_JOIN_MS, INSUFFICIENT2, CAP_CODES, WAIT_CODES, NO_ANSWER_CODES, NOTHING_PAID, CAP_FROM, PROGRESS_LINE, SHOWN_PROGRESS, SELF_PAY_LINE, isProgressLine, fail46, nothingPaid;
136556
+ var DEFAULT_MODEL2, CHAT_DEFAULT_MODEL, CHAT_MAX_TOKENS, CHAT_SHORT_TOKENS, DEFAULT_ANSWER_CAP_ATOMIC, DEFAULT_CHAT_CAP_ATOMIC, CHEAPEST_MODEL, STILL_WAITING_MS, providerKept, higherCap, POSITIVE_ATOMIC9, SHINJUKU_FEE_ATOMIC, SHORT_QUESTION_TOKENS, PASTE_JOIN_MS, INSUFFICIENT2, CAP_CODES, WAIT_CODES, NO_ANSWER_CODES, FLOAT_WAIT_WORDS, NOTHING_PAID, CAP_FROM, PROGRESS_LINE, SHOWN_PROGRESS, SELF_PAY_LINE, isProgressLine, fail46, nothingPaid;
136552
136557
  var init_chat = __esm({
136553
136558
  "wallet/src/inference/chat.mjs"() {
136554
136559
  "use strict";
@@ -136581,6 +136586,11 @@ var init_chat = __esm({
136581
136586
  CAP_CODES = /^(spend_payment_cap_exceeded|mcp_session_cap_exceeded|mcp_cap_argument_above_launch_cap|p03_float_over_maximum)$/;
136582
136587
  WAIT_CODES = /_retry_same_request$|_retry_same_payment$|_retry_later$|^wallet_locked$|another_request_unresolved$/;
136583
136588
  NO_ANSWER_CODES = /^inference_(upstream_failed|response_invalid)$/;
136589
+ FLOAT_WAIT_WORDS = Object.freeze({
136590
+ p03_float_not_ready_retry_later: { what: "Shinjuku's payment service is not ready right now", seconds: 60 },
136591
+ p03_float_busy_retry_later: { what: "Shinjuku's payment service is busy right now", seconds: 30 },
136592
+ p03_float_payment_in_flight_retry_later: { what: "an earlier quote for this answer is still open at Shinjuku", seconds: 60 }
136593
+ });
136584
136594
  NOTHING_PAID = /\bnothing was (?:sent or )?paid\b|\bnothing was paid or signed\b/i;
136585
136595
  CAP_FROM = { line: "from this command line", setup: "set in setup", default: "the default" };
136586
136596
  PROGRESS_LINE = /^(?:tor|rpc|history|memo service): |^reading \d+ memos? from the memo service|^reading your private balance again\b|^getting your balance ready: moving \S+ USDC of one deposit\b/;
@@ -161715,9 +161725,16 @@ async function addFunds(values, deps) {
161715
161725
  plan.status = { ...plan.status ?? { stage: currentStage(store, plan) }, ended: iso2(deps.now()) };
161716
161726
  save2();
161717
161727
  const view2 = fundsView(store, plan, { now: deps.now(), running: false });
161718
- io.err(`${ctx.quiet ? "add-funds stopped" : `add-funds ${plan.fundsId} stopped at ${view2.stage}`}: nothing is lost. Run the same command again to continue.
161728
+ if (ctx.quiet) {
161729
+ const waits = view2.stages.find((entry) => entry.stage === view2.stage)?.waitsFor;
161730
+ io.err(`add-funds stopped: nothing is lost.${waits ? ` It was waiting for ${waits}.` : ""} To continue, run:
161731
+ ${commandLine("add-funds")}
161732
+ `);
161733
+ } else {
161734
+ io.err(`add-funds ${plan.fundsId} stopped at ${view2.stage}: nothing is lost. Run the same command again to continue.
161719
161735
  `);
161720
- printEnd(deps, view2, ctx.terminal);
161736
+ printEnd(deps, view2, ctx.terminal);
161737
+ }
161721
161738
  } finally {
161722
161739
  process.off("SIGINT", onSignal);
161723
161740
  process.off("SIGTERM", onSignal);
@@ -162176,6 +162193,12 @@ var UsageError = class extends Error {
162176
162193
  };
162177
162194
  var PublicFailure = class extends Error {
162178
162195
  };
162196
+ var AnswerDeclined = class extends PublicFailure {
162197
+ constructor(code2, plain) {
162198
+ super(`${code2}: ${plain}`);
162199
+ this.plain = plain;
162200
+ }
162201
+ };
162179
162202
  var QuestionCancelled = class extends PublicFailure {
162180
162203
  // Every terminal question comes before a payment or a send, so this is true at each one.
162181
162204
  constructor(interrupted) {
@@ -162542,7 +162565,7 @@ ${CURL_USEPOD_NEXT}`, { cause: error });
162542
162565
  if (response) return curlOutput(response, values, deps, probeId);
162543
162566
  const answer = String(await deps.ask(`Pay ${usdcText3(priceAtomic)} USDC for ${values.get("--url")}? [y/N] `)).trim();
162544
162567
  if (!/^y(es)?$/i.test(answer)) {
162545
- throw new PublicFailure("curl_payment_declined: you did not answer y, so nothing was paid. To pay, run the same command again and answer y");
162568
+ throw new AnswerDeclined("curl_payment_declined", "you did not answer y, so nothing was paid. To pay, run the same command again and answer y");
162546
162569
  }
162547
162570
  values.set("--max-payment", priceAtomic);
162548
162571
  return runCurlPaid(values, deps, { requestId });
@@ -162622,8 +162645,18 @@ var INFER_STDIN_MAX_BYTES = 1024 * 1024;
162622
162645
  var INFER_STDIN_EXAMPLE = `echo "Summarize x402 in one line" | ${CLI_WORD} infer - --model qwen3-8-flash`;
162623
162646
  var CURL_USEPOD_NEXT = `use \`${CLI_WORD} infer\` for the AI provider: it sends the prompt only through --tor or --proxy`;
162624
162647
  function unshieldArgs(command2, args) {
162625
- if (args.length === 0 || args.includes("--amount") || !/^(all|[0-9]+(\.[0-9]+)?)$/i.test(args[0])) return args;
162626
- return ["--amount", /^all$/i.test(args[0]) ? "all" : args[0], ...args.slice(1)];
162648
+ if (args.includes("--amount")) return args;
162649
+ const known = new Map(command2.flags.map((entry) => [entry.name, entry]));
162650
+ for (let index = 0; index < args.length; index += 1) {
162651
+ const token = args[index];
162652
+ if (token.startsWith("--")) {
162653
+ if (known.has(token) && !known.get(token).boolean) index += 1;
162654
+ continue;
162655
+ }
162656
+ if (!/^(all|[0-9]+(\.[0-9]+)?)$/i.test(token)) return args;
162657
+ return ["--amount", /^all$/i.test(token) ? "all" : token, ...args.slice(0, index), ...args.slice(index + 1)];
162658
+ }
162659
+ return args;
162627
162660
  }
162628
162661
  function inferArgs(command2, args) {
162629
162662
  const known = new Map(command2.flags.map((entry) => [entry.name, entry]));
@@ -163671,10 +163704,10 @@ function agentAppLines({ home, deps, npmVersion, skip = /* @__PURE__ */ new Set(
163671
163704
  }
163672
163705
  return lines.join("\n");
163673
163706
  }
163674
- function setupNextText({ home, deps, npmVersion, config, fundAsked, rerun, inferenceNow, targets = [], added = /* @__PURE__ */ new Set() }) {
163707
+ function setupNextText({ home, deps, npmVersion, config, fundAsked, rerun, targets = [], added = /* @__PURE__ */ new Set() }) {
163675
163708
  const parts = [];
163676
163709
  if (!fundAsked && !rerun) parts.push(fundingStepText());
163677
- if (!rerun || inferenceNow) parts.push(privateInferencePath(config));
163710
+ parts.push(privateInferencePath(config));
163678
163711
  if (targets.some((target) => !added.has(target))) {
163679
163712
  const byHand = hostConfigText({ home, env: deps.env, platform: deps.platform ?? process.platform, npmVersion, skip: added });
163680
163713
  if (byHand) parts.push(`Or add it by hand:
@@ -163682,8 +163715,7 @@ ${byHand}
163682
163715
  `);
163683
163716
  } else if (rerun && !targets.length) {
163684
163717
  parts.push([
163685
- "Your agent app keeps its MCP entry.",
163686
- "To add the wallet to another agent app, run one of these:",
163718
+ "To add the wallet to an agent app, run one of these:",
163687
163719
  ...HOST_TARGETS.map((target) => ` ${cli2()} setup --add-to ${target}`),
163688
163720
  ""
163689
163721
  ].join("\n"));
@@ -163723,10 +163755,21 @@ function recordOwnAddress(home, address5, deps) {
163723
163755
  return [` note your own address was not saved: ${why}`];
163724
163756
  }
163725
163757
  }
163726
- async function offerFundNow(deps, { tor }) {
163758
+ async function offerFundNow(deps, { tor, created }) {
163759
+ const io = deps.io;
163760
+ try {
163761
+ await askFundNow(deps, { tor, created });
163762
+ } catch (error) {
163763
+ if (!(error instanceof QuestionCancelled)) throw error;
163764
+ io.out(`Setup is done; no money was added. To add money later, ask your agent to add funds, or run:
163765
+ ${FUND_COMMAND}
163766
+ `);
163767
+ }
163768
+ }
163769
+ async function askFundNow(deps, { tor, created }) {
163727
163770
  const io = deps.io;
163728
163771
  for (let attempt = 0; attempt < 3; attempt += 1) {
163729
- const answer = String(await deps.ask(attempt === 0 ? "The wallet starts empty. Add money now? Amount in USDC, from 0.01 (press Enter to skip): " : "Add money now? Amount in USDC, from 0.01 (press Enter to skip): ")).trim();
163772
+ const answer = String(await deps.ask(attempt === 0 && created ? "The wallet starts empty. Add money now? Amount in USDC, from 0.01 (press Enter to skip): " : "Add money now? Amount in USDC, from 0.01 (press Enter to skip): ")).trim();
163730
163773
  if (!answer || /^(n|no|skip)$/i.test(answer)) break;
163731
163774
  const atomic4 = usdcToAtomic(answer);
163732
163775
  if (!atomic4 || BigInt(atomic4) < PAY_ME_MIN_ATOMIC) {
@@ -164158,7 +164201,7 @@ async function runSetupCommand(values, deps) {
164158
164201
 
164159
164202
  `);
164160
164203
  const config2 = setupConfigOf(home);
164161
- await offerFundNow(deps, { tor: config2?.tor === true });
164204
+ await offerFundNow(deps, { tor: config2?.tor === true, created: !old });
164162
164205
  const targets2 = values.get("--add-to") ?? [];
164163
164206
  io.out(setupNextText({
164164
164207
  home,
@@ -164167,7 +164210,6 @@ async function runSetupCommand(values, deps) {
164167
164210
  config: config2,
164168
164211
  fundAsked: true,
164169
164212
  rerun: values.get(SETUP_RERUN) === "settings",
164170
- inferenceNow: privateInference === true && (!old || old.inference?.enabled !== true),
164171
164213
  targets: targets2,
164172
164214
  added: new Set(targets2)
164173
164215
  }));
@@ -164228,15 +164270,14 @@ Copy it to two offline places now; it is the only way to restore this wallet.
164228
164270
  const targets = values.get("--add-to") ?? [];
164229
164271
  const added = targets.length ? addToHosts(targets, home, deps, { force: values.has("--force"), npmVersion }) : /* @__PURE__ */ new Set();
164230
164272
  const config = setupConfigOf(home);
164231
- const inferenceNow = summary.privateInference === true && (!rerun || old?.inference?.enabled !== true);
164232
164273
  if (inProxiedRun(deps.env) && deps.env[SETUP_NEXT_BY_PARENT_ENV] === "1") {
164233
164274
  if (targets.some((target) => !added.has(target))) {
164234
- io.out(setupNextText({ home, deps, npmVersion, config, fundAsked: true, rerun: true, inferenceNow: false, targets, added }));
164275
+ io.out(setupNextText({ home, deps, npmVersion, config, fundAsked: true, rerun: true, targets, added }));
164235
164276
  }
164236
164277
  return void 0;
164237
164278
  }
164238
- if (interactive) await offerFundNow(deps, { tor: config?.tor === true });
164239
- io.out(setupNextText({ home, deps, npmVersion, config, fundAsked: interactive, rerun, inferenceNow, targets, added }));
164279
+ if (interactive) await offerFundNow(deps, { tor: config?.tor === true, created: !old });
164280
+ io.out(setupNextText({ home, deps, npmVersion, config, fundAsked: interactive, rerun, targets, added }));
164240
164281
  }
164241
164282
  async function confirmAboveBalanceCap(deps, atomic4) {
164242
164283
  if (BigInt(atomic4) <= MAX_SHIELDED_BALANCE_ATOMIC) return true;
@@ -164881,6 +164922,8 @@ var COMMANDS = [
164881
164922
  flag2("--data-file", "<file>", "the request body from a file (POST)"),
164882
164923
  flag2("--out", "<file>", "-o: write the answer to this private file (mode 600) instead of stdout"),
164883
164924
  bool2("--include", "-i: print the HTTP status line and headers before the body (a paid answer has status 200 and the x-shinjuku-payment receipt header)"),
164925
+ // CU1 (mcp56, published 0.3.101): a terminal curl printed the 4-line "history: ..." paragraph before the pay question.
164926
+ bool2("--verbose", "in a terminal, also show the wallet's own progress lines (Tor, the RPC relay, the pool history, the memo reads); without it a terminal shows only the price question, the answer, and what it paid"),
164884
164927
  flag2("--request-id", "<id>", "your stable name for this request; default curl-<random>, printed on stderr before any payment. Rerun with the same id to resume a stopped run: it never pays twice"),
164885
164928
  ...payerSessionFlags()
164886
164929
  ],
@@ -164903,6 +164946,7 @@ var COMMANDS = [
164903
164946
  nextInOutput: true,
164904
164947
  normalizeArgs: curlArgs,
164905
164948
  validate: validateCurl,
164949
+ quietProgress: (values, deps) => terminalQuiet(values, deps),
164906
164950
  run: (args, values, deps, io) => deps.curlMain(values, { ...deps, io })
164907
164951
  },
164908
164952
  {
@@ -165171,8 +165215,10 @@ var COMMANDS = [
165171
165215
  next: SETUP_NEXT,
165172
165216
  // Printed as "Next: ..." after a run (the runner's label), as the help page prints it.
165173
165217
  nextLabel: "Next",
165174
- // A rerun of a complete setup (SETUP_RERUN): the agent app already has the entry.
165175
- nextAfterRun: (values) => values.get(SETUP_RERUN) === "settings" ? 'close and open your agent app so it starts the wallet with these settings, then ask "what is my balance".' : values.get(SETUP_RERUN) === "own-address" ? "ask your agent to send money to your own address: it sends without asking you each time." : SETUP_NEXT,
165218
+ // A rerun of a complete setup (SETUP_RERUN): it cannot tell whether an agent app has the entry (0.3.101 live pass).
165219
+ nextAfterRun: (values) => values.get(SETUP_RERUN) === "settings" ? `chat privately with an AI in this terminal:
165220
+ ${CLI_WORD} chat
165221
+ If an agent app already runs the wallet, close and open it so it reads these settings.` : values.get(SETUP_RERUN) === "own-address" ? "ask your agent to send money to your own address: it sends without asking you each time." : SETUP_NEXT,
165176
165222
  // In a terminal its progress lines (tor:, rpc:, history:) show only with --verbose; Tor trouble shows in plain words
165177
165223
  // (inference/chat.mjs hideProgressLines). Live run 2026-10-24 08:26 UTC (npm 0.3.97, laptop, Tor on): setup printed
165178
165224
  // the raw onion line "tor: the onion ... gave no answer (the stream failed); its requests move to ...". The Tor run's
@@ -166179,7 +166225,7 @@ async function askUnshield(args, values, deps) {
166179
166225
  deps.io.err(`${why}
166180
166226
  `);
166181
166227
  }
166182
- throw new PublicFailure(`unshield_declined: three answers were not usable, so nothing was sent. To send, run:
166228
+ throw new AnswerDeclined("unshield_declined", `three answers were not usable, so nothing was sent. To send, run:
166183
166229
  ${cli2()} unshield`);
166184
166230
  };
166185
166231
  const out = [...args];
@@ -166206,16 +166252,31 @@ async function askUnshield(args, values, deps) {
166206
166252
  }
166207
166253
  let whole;
166208
166254
  if (values.get("--amount") === "all") {
166255
+ const open4 = () => (deps.openWalletStore ?? openWalletStore)(resolve39(values.get("--wallet")), payerPassphrase(values, deps));
166256
+ let store;
166209
166257
  try {
166210
- whole = savedBalance((deps.openWalletStore ?? openWalletStore)(resolve39(values.get("--wallet")), payerPassphrase(values, deps)));
166258
+ store = open4();
166259
+ whole = savedBalance(store);
166211
166260
  } catch {
166212
166261
  whole = void 0;
166213
166262
  }
166263
+ const refreshArgs = !whole && store ? homeRefreshArgs(store, deps) : void 0;
166264
+ if (refreshArgs) {
166265
+ deps.io.err("Reading your private balance from the chain, so the question names the amount...\n");
166266
+ const silent = { out: () => {
166267
+ }, err: () => {
166268
+ } };
166269
+ try {
166270
+ if (await runShinjukuWallet(["balance", ...refreshArgs], { ...deps, io: silent }) === 0) whole = savedBalance(open4());
166271
+ } catch {
166272
+ whole = void 0;
166273
+ }
166274
+ }
166214
166275
  }
166215
- const wholeWords = !whole ? "" : whole.current ? ` (${usdcOr(whole.atomic.toString())})` : ` (about ${usdcOr(whole.atomic.toString())} at its last read)`;
166276
+ const wholeWords = !whole ? ` (its amount could not be read now; answer n and run ${cli2()} balance to see it)` : whole.current ? ` (${usdcOr(whole.atomic.toString())})` : ` (about ${usdcOr(whole.atomic.toString())} at its last read)`;
166216
166277
  const what = values.get("--amount") === "all" ? `your whole private balance${wholeWords}` : `${usdcText3(values.get("--amount"))} USDC`;
166217
166278
  const answer = String(await deps.ask(`Send ${what} to ${values.get("--to")}? [y/N] `)).trim();
166218
- if (!/^y(es)?$/i.test(answer)) throw new PublicFailure(`unshield_declined: you did not answer y, so nothing was sent. To send, run:
166279
+ if (!/^y(es)?$/i.test(answer)) throw new AnswerDeclined("unshield_declined", `you did not answer y, so nothing was sent. To send, run:
166219
166280
  ${cli2()} unshield`);
166220
166281
  return out;
166221
166282
  }
@@ -167651,8 +167712,8 @@ function floatFailureHint(reason, floatError) {
167651
167712
  if (/p03_float_answer_invalid_refund_pending/.test(reason)) {
167652
167713
  return "Shinjuku was paid, but its answer held no valid payment for this seller, so nothing went to the seller. Refund of the amount paid (price + fee) on the way (up to about 7 min). Nothing more to do";
167653
167714
  }
167654
- if (/p03_float_busy_retry_later/.test(reason)) return "nothing was paid: Shinjuku's shared float is busy right now. Rerun the same command in about 30 seconds";
167655
- if (/p03_float_not_ready_retry_later/.test(reason)) return "nothing was paid: Shinjuku's shared float is not ready yet (it is being filled). Rerun the same command in about a minute";
167715
+ if (/p03_float_busy_retry_later/.test(reason)) return "nothing was paid: Shinjuku's payment service is busy right now. Rerun the same command in about 30 seconds";
167716
+ if (/p03_float_not_ready_retry_later/.test(reason)) return "nothing was paid: Shinjuku's payment service is not ready right now. Rerun the same command in about a minute";
167656
167717
  if (/p03_float_payment_in_flight_retry_later/.test(reason)) return "nothing was paid: an earlier quote for this payment is still open at Shinjuku. Rerun the same command in about a minute";
167657
167718
  if (/p03_float_price_above_capacity/.test(reason)) {
167658
167719
  return `nothing was paid: the seller's price is above the largest price Shinjuku pays for one request now (largestAtomic in ${config}). Pay a cheaper seller, or try again later`;
@@ -167661,10 +167722,10 @@ function floatFailureHint(reason, floatError) {
167661
167722
  return `nothing was paid: the seller's price plus the Shinjuku fee (feeAtomic in ${config}; 1000 = 0.001 USDC) is above your maximum (--maximum-atomic or --max-payment). Rerun with a maximum of at least price + fee`;
167662
167723
  }
167663
167724
  if (/p03_float_seller_uses_our_facilitator/.test(reason)) {
167664
- return "nothing was paid: this seller's exact offer settles through Shinjuku's own pocket facilitator, which cannot take a payment from the shared float. Ask the seller for its shielded-exact offer: the wallet pays that one first";
167725
+ return "nothing was paid: this seller's exact offer settles through Shinjuku's own pocket facilitator, which cannot take a payment from Shinjuku's payment service. Ask the seller for its shielded-exact offer: the wallet pays that one first";
167665
167726
  }
167666
167727
  if (/p03_float_not_offered/.test(reason)) {
167667
- return "nothing was paid: the facilitator (--memo-service) does not run float pay, so a seller that takes only standard exact cannot be paid through it. Use the facilitator of this wallet's pool";
167728
+ return "nothing was paid: the facilitator (--memo-service) does not run Shinjuku's payment service, so a seller that takes only standard exact cannot be paid through it. Use the facilitator of this wallet's pool";
167668
167729
  }
167669
167730
  if (/p03_float_config_unreadable/.test(reason)) return `nothing was paid: ${config} did not answer, or its answer is not valid. Rerun the same command later`;
167670
167731
  if (/p03_float_config_mismatch/.test(reason)) return "nothing was paid: the facilitator's float runs on another network or token than this wallet's pool. Use the facilitator of this wallet's pool";
@@ -167957,6 +168018,7 @@ function strayWordIn(command2, args) {
167957
168018
  }
167958
168019
  async function runShinjukuWallet(argv2, overrides = {}) {
167959
168020
  const deps = { ...defaultDependencies(), ...overrides };
168021
+ const endsProcess = Object.keys(overrides).length === 0;
167960
168022
  setCommandVersionSource(() => deps.walletVersion().npm);
167961
168023
  const rawIo = deps.io;
167962
168024
  deps.io = { ...rawIo, out: (text3) => rawIo.out(fillCommandWords(text3)), err: (text3) => rawIo.err(fillCommandWords(text3)) };
@@ -168080,6 +168142,8 @@ This copy: ${walletVersionLine(deps.walletVersion())}
168080
168142
  writeRunResult(deps, command2, 0);
168081
168143
  return 0;
168082
168144
  } catch (error) {
168145
+ if (endsProcess) showProgressAgain = () => {
168146
+ };
168083
168147
  if (error instanceof RanBehindTorFailed) return error.exitCode;
168084
168148
  if (error instanceof UsageError) {
168085
168149
  let setUp = false;
@@ -168108,6 +168172,11 @@ This copy: ${walletVersionLine(deps.walletVersion())}
168108
168172
  }
168109
168173
  if (error instanceof QuestionCancelled) {
168110
168174
  io.err(`${CLI} ${command2.name} ${error.message}
168175
+ `);
168176
+ return 1;
168177
+ }
168178
+ if (error instanceof AnswerDeclined) {
168179
+ io.err(`${CLI} ${command2.name} stopped: ${error.plain}
168111
168180
  `);
168112
168181
  return 1;
168113
168182
  }