shinjuku-shield 0.3.254 → 0.3.255

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
@@ -8,7 +8,7 @@ web services and AI answers from your private balance, so the payment does
8
8
  not show who paid. It works inside your AI app (Claude, Cursor, Codex) and in
9
9
  a terminal. Only you hold the keys: they never leave your computer.
10
10
 
11
- This is version 0.3.254. The command is `shinjuku`.
11
+ This is version 0.3.255. The command is `shinjuku`.
12
12
 
13
13
  ## Set up
14
14
 
@@ -112,7 +112,7 @@ Add it yourself. The name of the wallet in your app is `shinjuku`.
112
112
  Claude Code:
113
113
 
114
114
  ```sh
115
- claude mcp add --scope user shinjuku -- npx -y --prefer-offline --no-audit --no-fund shinjuku-shield@0.3.254 mcp
115
+ claude mcp add --scope user shinjuku -- npx -y --prefer-offline --no-audit --no-fund shinjuku-shield@0.3.255 mcp
116
116
  ```
117
117
 
118
118
  `--prefer-offline` runs the copy of the wallet that npm saved. If npm has not saved it yet, that start asks
@@ -131,7 +131,7 @@ with the Releases table in
131
131
  Versions are published from GitHub Actions with npm provenance.
132
132
 
133
133
  `shinjuku-shield` is the package that holds the wallet. `shinjuku-shielded`
134
- 0.3.254, its older name, runs this package at the same version, so wallets
134
+ 0.3.255, its older name, runs this package at the same version, so wallets
135
135
  installed under that name keep updating. New installs use `shinjuku`.
136
136
 
137
137
  The full guide is
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": "a1a6fceeff167022d55c4b58f90dabe79565d545ea52e48fd73fa04c890534f6",
5
- "bytes": 10875671,
6
- "sourceCommit": "9a5fa6769207843962e6d2e25cf765c98e402e71",
4
+ "sha256": "82657f55e376e4d0998bbd34b3ac591bbddaa0ced57505f7f9f499c92e2b36f1",
5
+ "bytes": 10887357,
6
+ "sourceCommit": "d2f342f4816604eae9e13dba27f508b6d8df3fe0",
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",
@@ -97,8 +97,8 @@
97
97
  },
98
98
  {
99
99
  "path": "wallet/src/mcp/views/wallet-card.html",
100
- "sha256": "82ac288682405dbed100e027d3d8558502ee3103fade9f301b9e9b30783c56cf",
101
- "bytes": 5962
100
+ "sha256": "c7f7eaddf6e124b1315605a97bba65c775bcb2058f4f19d95172a80440107503",
101
+ "bytes": 7732
102
102
  },
103
103
  {
104
104
  "path": "wallet/vendor/ext-apps-1.7.5/app-with-deps.js",
@@ -1075,8 +1075,8 @@
1075
1075
  ],
1076
1076
  "seller": {
1077
1077
  "file": "shinjuku-seller.mjs",
1078
- "sha256": "c06dc2843c63a590ab895ff7690b893a0ec984c4a1a25cc0ceab239e52999cfe",
1079
- "bytes": 4301500,
1078
+ "sha256": "149d22a1b3a12820eead9d518b608b8bf1b94e827555d1680c61f7c7cbea0c89",
1079
+ "bytes": 4301749,
1080
1080
  "entry": "wallet/src/seller/exact/index.mjs",
1081
1081
  "external": [
1082
1082
  "@x402/core/http",
@@ -2080,5 +2080,5 @@
2080
2080
  }
2081
2081
  ]
2082
2082
  },
2083
- "publishedAt": "2026-11-20T02:29:30.665Z"
2083
+ "publishedAt": "2026-11-20T05:59:45.742Z"
2084
2084
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "shinjuku-shield",
3
- "version": "0.3.254",
3
+ "version": "0.3.255",
4
4
  "mcpName": "io.github.ShinjukuStaition/shinjuku-shield",
5
5
  "description": "Shinjuku Shield, private x402 payments 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": "a1a6fcee",
7
- "shinjukuSha256": "a1a6fceeff167022d55c4b58f90dabe79565d545ea52e48fd73fa04c890534f6",
6
+ "shinjukuRelease": "82657f55",
7
+ "shinjukuSha256": "82657f55e376e4d0998bbd34b3ac591bbddaa0ced57505f7f9f499c92e2b36f1",
8
8
  "license": "SEE LICENSE IN LICENSE.txt",
9
9
  "author": "Shinjuku Shield",
10
10
  "homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
@@ -42282,6 +42282,7 @@ function terminalPathKeys() {
42282
42282
  }
42283
42283
  function typedCommandFor(path, { env, platform = process.platform } = {}) {
42284
42284
  const name = typedCommandName(COMMAND_PACKAGE, platform);
42285
+ if (thisWindowTyped && path && platform === process.platform && (env === void 0 || env === process.env) && dirname8(path).replace(/\/+$/, "") === String(pathStepFolder).replace(/\/+$/, "")) return thisWindowTyped;
42285
42286
  if (platform !== "win32" || platform !== process.platform || env !== void 0 && env !== process.env || !path) return name;
42286
42287
  const keys3 = terminalPathKeys();
42287
42288
  if (!keys3 || keys3.has(folderKey(dirname8(path)))) return name;
@@ -42351,7 +42352,7 @@ function installedCommand(options = {}) {
42351
42352
  }
42352
42353
  return { path };
42353
42354
  }
42354
- var versionSource, ownNpmVersion, runningNpmVersion, NPM_RUN_FOLDER, isRunnable, kept, keptTerminal, keptSame, folderKey, OWN_PACKAGES, readPackage;
42355
+ var versionSource, ownNpmVersion, runningNpmVersion, NPM_RUN_FOLDER, isRunnable, kept, keptTerminal, keptSame, folderKey, pathStepFolder, thisWindowTyped, OWN_PACKAGES, readPackage;
42355
42356
  var init_commandName = __esm({
42356
42357
  "wallet/src/cli/commandName.mjs"() {
42357
42358
  "use strict";
@@ -699,11 +699,32 @@ var init_fs = __esm({
699
699
  var button = document.getElementById("refresh");
700
700
  button.addEventListener("click", function () { S.refresh(current, button); });
701
701
  var body = document.getElementById("body");
702
+ // The first view this card drew (its rev and balance): a later, newer view came from Refresh (views/shared.js draws only
703
+ // a newer rev). Row 119 on 0.3.254 (Codex app, 2026-11-20, review finding 8): after Refresh the card said "You can spend
704
+ // 0.1 USDC now" while the chat text under it, written from the first answer, still said 0 USDC. The card cannot change
705
+ // that text: it says when it was updated and that it is newer, and gives the app's model the new words (tellModel), so
706
+ // the next chat answer uses them. Session-made, 2026-11-20 (its commit names it).
707
+ var firstRev = 0;
708
+ var firstBalance = null;
709
+ var toldRev = 0;
710
+ var utcTime = function (ms) { var iso = new Date(ms).toISOString(); return iso.slice(11, 16) + " UTC"; };
702
711
  S.start(function (view, data) {
703
712
  current = view;
704
713
  body.hidden = false;
705
- document.getElementById("balance").textContent = view.balance !== null && view.balance !== undefined ? view.balance + " USDC" : "being checked";
706
- document.getElementById("note").textContent = view.note || "";
714
+ var balanceText = view.balance !== null && view.balance !== undefined ? view.balance + " USDC" : "being checked";
715
+ document.getElementById("balance").textContent = balanceText;
716
+ var rev = typeof data.rev === "number" && isFinite(data.rev) && data.rev > 0 ? data.rev : 0;
717
+ if (!firstRev) { firstRev = rev; firstBalance = balanceText; }
718
+ var updated = rev > firstRev;
719
+ var changed = updated && balanceText !== firstBalance;
720
+ document.getElementById("note").textContent = updated
721
+ ? "Updated " + utcTime(rev) + (changed ? ": newer than the chat text about this balance" : "") + (view.note ? ". " + view.note : "")
722
+ : view.note || "";
723
+ if (changed && rev > toldRev && typeof data.say === "string" && data.say) {
724
+ toldRev = rev;
725
+ S.tellModel("The user pressed Refresh on the Shinjuku Shield balance card at " + utcTime(rev) + ". The wallet now says: " + data.say
726
+ + " This is newer than any balance said earlier in this chat; use it, and do not repeat the older number.");
727
+ }
707
728
  var rows = document.getElementById("rows");
708
729
  rows.replaceChildren();
709
730
  if (view.publicUsdc !== null && view.publicUsdc !== undefined) rows.appendChild(S.row("Public USDC on your own address", view.publicUsdc + " USDC"));
@@ -718,7 +739,8 @@ var init_fs = __esm({
718
739
  // No Refresh for a host that does not pass a view's tool calls to the wallet (the chat asks again there).
719
740
  button.hidden = !S.canCallServer();
720
741
  button.disabled = !(view.refresh && view.refresh.tool) || button.hidden;
721
- S.message(typeof data.say === "string" ? data.say : "");
742
+ // A card after a payment (tools.mjs paidCardView) shows its own short line, not the AI answer or the seller's data.
743
+ S.message(typeof view.message === "string" && view.message ? view.message : typeof data.say === "string" ? data.say : "");
722
744
  }, function (result, fallback) {
723
745
  // No balance view in this answer (a refusal, an error, a failed Refresh): no old or empty balance stays on screen.
724
746
  current = null;
@@ -739,7 +761,7 @@ var init_fs = __esm({
739
761
  return !!payment && typeof payment === "object" && typeof payment.at === "string" && typeof payment.host === "string" && usdc(payment.usdc);
740
762
  };
741
763
  return data.ok === true && view.kind === "wallet-card" && (view.balance === null || usdc(view.balance))
742
- && (view.publicUsdc === undefined || view.publicUsdc === null || usdc(view.publicUsdc)) && text(view.note)
764
+ && (view.publicUsdc === undefined || view.publicUsdc === null || usdc(view.publicUsdc)) && text(view.note) && text(view.message)
743
765
  && (view.payments === undefined || view.payments === null || (Array.isArray(view.payments) && view.payments.every(row)));
744
766
  });
745
767
  })();
@@ -51224,13 +51246,19 @@ function stepName(words2, line, { env = process.env } = {}) {
51224
51246
  const key = homeKeyOf(words2);
51225
51247
  return inHomeJob(env) && key ? `press [${key}] on the home screen` : line;
51226
51248
  }
51227
- var HOME_JOB_ENV, LAUNCHER_PID_ENV, inHomeJob, HOME_KEY, JOB_NAME, jobLabel, homeKeyOf;
51249
+ var HOME_JOB_ENV, LAUNCHER_PID_ENV, inHomeJob, JOB_BAR_ROWS, JOB_BAR_MIN_ROWS, JOB_LINE_WORDS, JOB_BAR_ENV, holdsJobBar, jobRows, HOME_KEY, JOB_NAME, jobLabel, homeKeyOf;
51228
51250
  var init_homeJob = __esm({
51229
51251
  "wallet/src/cli/homeJob.mjs"() {
51230
51252
  "use strict";
51231
51253
  HOME_JOB_ENV = "SHINJUKU_WALLET_HOME_JOB";
51232
51254
  LAUNCHER_PID_ENV = "SHINJUKU_WALLET_LAUNCHER_PID";
51233
51255
  inHomeJob = (env = process.env) => env?.[HOME_JOB_ENV] === "1";
51256
+ JOB_BAR_ROWS = 2;
51257
+ JOB_BAR_MIN_ROWS = 10;
51258
+ JOB_LINE_WORDS = ["\u25C6 ", "shinjuku-shield", " \xB7 "];
51259
+ JOB_BAR_ENV = "SHINJUKU_WALLET_JOB_BAR";
51260
+ holdsJobBar = (rows2, columns, name) => Boolean(name) && Number.isSafeInteger(rows2) && rows2 >= JOB_BAR_MIN_ROWS && (Number.isSafeInteger(columns) ? columns : 80) >= [...`${JOB_LINE_WORDS.join("")}${name}`].length + 1;
51261
+ jobRows = (rows2, env = process.env, columns = void 0) => holdsJobBar(rows2, columns, env?.[JOB_BAR_ENV]) ? rows2 - JOB_BAR_ROWS : rows2;
51234
51262
  HOME_KEY = { "add-funds": "a", unshield: "u", "pay-me": "g", curl: "p", chat: "t", setup: "s", restore: "r", limits: "l" };
51235
51263
  JOB_NAME = {
51236
51264
  "add-funds": "add funds",
@@ -52212,7 +52240,8 @@ ${command}`;
52212
52240
  const plain = plainTorTrouble(text3);
52213
52241
  if (plain !== void 0) {
52214
52242
  if (plain) {
52215
- err(`${process.stderr.isTTY ? "\r\x1B[K" : ""}${plain}
52243
+ if (process.stderr.isTTY) err("\r\x1B[K");
52244
+ err(`${plain}
52216
52245
  `);
52217
52246
  try {
52218
52247
  promptRedraw?.();
@@ -61569,6 +61598,7 @@ function terminalPathKeys() {
61569
61598
  }
61570
61599
  function typedCommandFor(path, { env, platform = process.platform } = {}) {
61571
61600
  const name = typedCommandName(COMMAND_PACKAGE, platform);
61601
+ if (thisWindowTyped && path && platform === process.platform && (env === void 0 || env === process.env) && dirname12(path).replace(/\/+$/, "") === String(pathStepFolder).replace(/\/+$/, "")) return thisWindowTyped;
61572
61602
  if (platform !== "win32" || platform !== process.platform || env !== void 0 && env !== process.env || !path) return name;
61573
61603
  const keys3 = terminalPathKeys();
61574
61604
  if (!keys3 || keys3.has(folderKey2(dirname12(path)))) return name;
@@ -61643,13 +61673,25 @@ function windowsNpmFolderOffPath({ env = process.env, platform = process.platfor
61643
61673
  function notePathStep(state2, folder) {
61644
61674
  pathStepSaid = state2;
61645
61675
  pathStepFolder = folder;
61676
+ const trim = (dir) => String(dir).replace(/\/+$/, "");
61677
+ const here4 = String(process.env.PATH ?? "").split(":").some((dir) => dir && trim(dir) === trim(folder));
61678
+ thisWindowTyped = (state2 === "profile-added" || state2 === "profile-present") && folder && process.platform !== "win32" && !here4 ? posixTyped(join13(folder, COMMAND_PACKAGE)) : void 0;
61679
+ if (thisWindowTyped) refreshCommandName();
61680
+ }
61681
+ function posixTyped(file, home = process.env.HOME) {
61682
+ const plain = /^[A-Za-z0-9._\/-]+$/;
61683
+ if (home && file.startsWith(`${home.replace(/\/+$/, "")}/`)) {
61684
+ const rest = file.slice(home.replace(/\/+$/, "").length + 1);
61685
+ if (plain.test(rest)) return `~/${rest}`;
61686
+ }
61687
+ return plain.test(file) ? file : `'${file.replace(/'/g, "'\\''")}'`;
61646
61688
  }
61647
61689
  function terminalUseLinesHere(npmVersion, options = {}) {
61648
61690
  const platform = options.platform ?? process.platform;
61649
61691
  const help = `${typedCommandName(COMMAND_PACKAGE, platform)} help`;
61650
61692
  if (pathStepSaid && options.env === void 0) {
61651
61693
  const node3 = nodeFirstSentence({ folder: pathStepFolder, platform });
61652
- if (pathStepSaid === "profile-added" || pathStepSaid === "profile-present") return [...node3 ? [node3] : [], `Open a new terminal to type ${help} and the other commands.`];
61694
+ if (pathStepSaid === "profile-added" || pathStepSaid === "profile-present") return [...node3 ? [node3] : [], ...thisWindowLines("help")];
61653
61695
  return [
61654
61696
  ...node3 ? [node3] : [],
61655
61697
  pathStepSaid === "profile" ? `After that profile line, a new terminal types ${help} and the other commands. In this terminal, type the longer command, for example:` : pathStepSaid === "failed" ? `After you add that folder to your PATH, a new window types ${help} and the other commands. In this window, type the longer command, for example:` : `Open a new window to type ${help} and the other commands. In this window, type the longer command, for example:`,
@@ -61662,6 +61704,15 @@ function terminalUseLinesHere(npmVersion, options = {}) {
61662
61704
  ` ${oneTimeCommandLine("balance", npmVersion, { platform })}`
61663
61705
  ];
61664
61706
  }
61707
+ function thisWindowLines(words2) {
61708
+ if (!thisWindowTyped) return [];
61709
+ const line = words2 ? `${thisWindowTyped} ${words2}` : thisWindowTyped;
61710
+ return [
61711
+ `This window does not know the ${COMMAND_PACKAGE} command yet. In this window, type:`,
61712
+ ` ${line}`,
61713
+ `A new terminal knows ${COMMAND_PACKAGE}: there, type ${words2 ? `${COMMAND_PACKAGE} ${words2}` : COMMAND_PACKAGE}.`
61714
+ ];
61715
+ }
61665
61716
  function compareNpmVersions(a, b) {
61666
61717
  const x = NPM_VERSION.exec(String(a ?? ""));
61667
61718
  const y = NPM_VERSION.exec(String(b ?? ""));
@@ -61717,7 +61768,7 @@ function olderInstalledCommand(npmVersion = ownNpmVersion(), options = {}) {
61717
61768
  line: plain ? installCommandText({ platform }) : oneTimeCommandLine("setup", npmVersion, { platform })
61718
61769
  };
61719
61770
  }
61720
- var versionSource, ownNpmVersion, runningNpmVersion, NPM_RUN_FOLDER, isRunnable, kept, keptTerminal, keptSame, NODE_FIRST_WORDS, NODE_FIRST_SENTENCE, folderKey2, pathStepSaid, pathStepFolder, OWN_PACKAGES, readPackage;
61771
+ var versionSource, ownNpmVersion, runningNpmVersion, NPM_RUN_FOLDER, isRunnable, kept, keptTerminal, keptSame, NODE_FIRST_WORDS, NODE_FIRST_SENTENCE, folderKey2, pathStepSaid, pathStepFolder, thisWindowTyped, OWN_PACKAGES, readPackage;
61721
61772
  var init_commandName = __esm({
61722
61773
  "wallet/src/cli/commandName.mjs"() {
61723
61774
  "use strict";
@@ -149085,6 +149136,8 @@ ${key}`).digest("hex").slice(0, 40)}.json`);
149085
149136
  description: `Ask ${label} one question: the uncensored ${company} model through Shinjuku's own AI address (it does not store the question), paid privately from the PRIVATE balance. Use this for any request to ask ` + label + ', never your own answer. Pass prompt (or messages). It is inference_chat with that model: the same price (inference_models lists it), spending limits, request_id rules and Tor rule (with Tor off the wallet asks the user to turn Tor on; nothing is paid without Tor). Example: { "prompt": "Name one ocean" }.',
149086
149137
  inputSchema: { ...chat.inputSchema, properties },
149087
149138
  annotations: { ...chat.annotations },
149139
+ // The same balance card as inference_chat after a payment (chat.run adds its data): the listing names the view too.
149140
+ ...typeof chat.view === "string" ? { view: chat.view } : {},
149088
149141
  async run(args = {}, ctx = {}) {
149089
149142
  if ((args?.prompt === void 0 || args.prompt === null) && (args?.messages === void 0 || args.messages === null)) {
149090
149143
  return refuse11(
@@ -149514,23 +149567,27 @@ ${key}`).digest("hex").slice(0, 40)}.json`);
149514
149567
  const poolWatchPollMs = ops.poolWatchPollMs ?? POOL_WATCH_POLL_MS;
149515
149568
  let poolWatchUntil = 0;
149516
149569
  let poolWatchTimer;
149517
- const noWalkRuns = () => paysInFlight === 0 && !refreshRun && !finalityWait && !historyPrewarmRunning();
149518
- let poolCountReading = false;
149519
- const walkIfPoolMoved = async () => {
149520
- if (poolCountReading) return;
149521
- poolCountReading = true;
149570
+ let poolWatchSlow = false;
149571
+ const watchMark = () => {
149522
149572
  let timing;
149523
149573
  try {
149524
149574
  timing = typeof session.timing === "function" ? session.timing() : void 0;
149525
149575
  } catch {
149526
149576
  timing = void 0;
149527
149577
  }
149528
- const mark = timing ? (phase, outcome) => {
149578
+ return timing ? (phase, outcome) => {
149529
149579
  try {
149530
149580
  timing(phase, outcome);
149531
149581
  } catch {
149532
149582
  }
149533
149583
  } : void 0;
149584
+ };
149585
+ const noWalkRuns = () => paysInFlight === 0 && !refreshRun && !finalityWait && !historyPrewarmRunning();
149586
+ let poolCountReading = false;
149587
+ const walkIfPoolMoved = async () => {
149588
+ if (poolCountReading) return;
149589
+ poolCountReading = true;
149590
+ const mark = watchMark();
149534
149591
  try {
149535
149592
  const store = session.openStore();
149536
149593
  const pool2 = String(store.state.pool);
@@ -149557,10 +149614,20 @@ ${key}`).digest("hex").slice(0, 40)}.json`);
149557
149614
  const watchPool = () => {
149558
149615
  if (!poolWatchOn || finalityClosed) return;
149559
149616
  poolWatchUntil = Date.now() + (ops.poolWatchMs ?? POOL_WATCH_MS);
149560
- if (poolWatchTimer !== void 0) return;
149617
+ if (poolWatchTimer !== void 0) {
149618
+ if (poolWatchSlow) {
149619
+ clearTimeout(poolWatchTimer);
149620
+ poolWatchTimer = void 0;
149621
+ } else return;
149622
+ }
149623
+ const next = () => {
149624
+ poolWatchSlow = Date.now() > poolWatchUntil;
149625
+ poolWatchTimer = setTimeout(tick, poolWatchSlow ? ops.poolWatchSlowMs ?? POOL_WATCH_SLOW_MS : poolWatchPollMs);
149626
+ poolWatchTimer.unref?.();
149627
+ };
149561
149628
  const tick = () => {
149562
149629
  poolWatchTimer = void 0;
149563
- if (finalityClosed || Date.now() > poolWatchUntil) return;
149630
+ if (finalityClosed) return;
149564
149631
  if (noWalkRuns()) {
149565
149632
  if (inTorRun()) void walkIfPoolMoved();
149566
149633
  else warmPaymentHistory(session);
@@ -149570,16 +149637,17 @@ ${key}`).digest("hex").slice(0, 40)}.json`);
149570
149637
  refreshKeptFloatConfig({ origin: new URL(session.memoServiceUrl).origin });
149571
149638
  } catch {
149572
149639
  }
149573
- try {
149574
- startPaymentToolsStandby(session.proofTools);
149575
- } catch {
149640
+ if (!poolWatchSlow) {
149641
+ try {
149642
+ startPaymentToolsStandby(session.proofTools);
149643
+ } catch {
149644
+ }
149576
149645
  }
149577
149646
  }
149578
- poolWatchTimer = setTimeout(tick, poolWatchPollMs);
149579
- poolWatchTimer.unref?.();
149647
+ withPhaseScope(watchMark(), "watch", () => markPhase(poolWatchSlow ? "tick-slow" : "tick"));
149648
+ next();
149580
149649
  };
149581
- poolWatchTimer = setTimeout(tick, poolWatchPollMs);
149582
- poolWatchTimer.unref?.();
149650
+ next();
149583
149651
  };
149584
149652
  const readBalance = (store, onPhase) => balanceFields(balanceNow(store, { programId: session.programId, onPhase }));
149585
149653
  const readBalanceNow = () => {
@@ -160831,6 +160899,20 @@ ${JSON.stringify(args ?? {})}`;
160831
160899
  done: "private now",
160832
160900
  expired: "closed"
160833
160901
  });
160902
+ const paidCardView = (answer) => {
160903
+ if (answer.ok !== true || answer.paid !== true || answer.replayed === true || !ATOMIC_TEXT.test(String(answer.paidAtomic ?? "")) || !ATOMIC_TEXT.test(String(answer.balanceAtomic ?? ""))) return void 0;
160904
+ return {
160905
+ kind: "wallet-card",
160906
+ balance: usdcText3(answer.balanceAtomic),
160907
+ note: `After this payment of ${usdcText3(answer.paidAtomic)} USDC`,
160908
+ publicUsdc: null,
160909
+ publicNotRead: false,
160910
+ tor: null,
160911
+ payments: null,
160912
+ message: `You can spend ${usdcText3(answer.balanceAtomic)} USDC now.`,
160913
+ refresh: { tool: "wallet_balance", arguments: {} }
160914
+ };
160915
+ };
160834
160916
  const VIEW_TOOLS = Object.freeze({
160835
160917
  wallet_balance: { uri: "ui://shinjuku/wallet-card", appVisible: true, build: (answer) => {
160836
160918
  if (answer.ok === false) return void 0;
@@ -160867,6 +160949,13 @@ ${JSON.stringify(args ?? {})}`;
160867
160949
  refresh: { tool: "wallet_balance", arguments: {} }
160868
160950
  };
160869
160951
  } },
160952
+ // Row 119 on 0.3.254 (Codex app, 2026-11-20, Codex review finding 8): a balance card read before an AI answer ("You can
160953
+ // spend 0.1 USDC now") stayed the newest card beside the paid Kimi answer. A paid AI answer or seller payment already
160954
+ // carries the balance after it (balanceAnswer from the saved walk; that run's answers: 0.068468, 0.066379, 0.062731,
160955
+ // each exactly the one before less paidAtomic), so it draws the same card with that balance. Session-made, 2026-11-20
160956
+ // (its commit names it).
160957
+ inference_chat: { uri: "ui://shinjuku/wallet-card", build: (answer) => paidCardView(answer) },
160958
+ pay_for_service: { uri: "ui://shinjuku/wallet-card", build: (answer) => paidCardView(answer) },
160870
160959
  check_price: { uri: "ui://shinjuku/price-card", build: (answer, args, { cardable = true } = {}) => {
160871
160960
  let host = "";
160872
160961
  try {
@@ -162020,7 +162109,7 @@ function createSetupTools({
162020
162109
  finalPending
162021
162110
  };
162022
162111
  }
162023
- var import_web3137, X402_V1_NEXT, shownCaps, shinjukuWord, SEND_RESULT_READ, sendQuestionNext, SEND_KEPT_ON_DISK, RELEASE_RETRY_MS, STAGE_WORDS2, slowReadWords, stageWords, INTERNAL_BALANCE_DETAIL, shownBreakdown, sessionLeftShown, RESOURCE_PAYMENT_WAL_PREFIX2, POOL_LAYOUT_CODE, POOL_LAYOUT_UPDATE, AI_ONION_UNAVAILABLE_SAY, USEPOD_VIA_INFERENCE_CHAT, TOR_ON_RESTART_SAY, askTorOnStep, SEND_RUNS_ON, DEPOSIT_RUNS_ON, CLI_FUNDS_PLAN_PREFIX, CLI_FUNDS_SCHEMA, SELF_PAY_ORIGIN3, REQUEST_ID4, POSITIVE_ATOMIC6, PRIVATE_HOST3, FORBIDDEN_HEADERS3, MAX_BODY_BYTES2, PREVIEW_SELLER_READ_MS, PREVIEW_BODY_OPEN_MS, CALL_BUDGET_MS, budgetLeft, PAY_ANSWER_MARGIN_MS, MONEY_FIRST_ANSWER_MS, HERMES_CALL_WAIT_MS, hermesLeft, TOOL_PLAIN_FIRST, UPDATE_CHECK_WAIT_MS, BALANCE_AFTER_LANDING_MS, JOIN_CALL_MAX_MS, JOIN_CALL_ANSWER_MARGIN_S, PAY_AFTER_JOIN_MS, joinAnswerSeconds, JOIN_TIME_MS, JOIN_NUDGE_QUIET_MS, SPEND_TOOLS, MOVES_WHILE_READING, USER_ACTION_TOOLS, JOIN_STEP_MS, sleep2, PROGRESS_EVERY_MS2, READ_BUDGET_MS, ASK_PRIVATE_TOOLS, TOR_WAIT_IN_CALL_MS, TOR_ANSWER_KEEP_MS, UNPAID_TOR_TRY_MS, UNPAID_TOR_OPEN_MS, UNPAID_CLEAR_MS, READ_BUDGET_TOOLS, FLOAT_BUSY_CODES, RETRY_MARGIN_MS, ASK_PAY_CODES, runningNpmVersion2, terminalCommand2, capPlaceWords, noLimitSetLine, CAP_NAMES, capName, entryPlaces, capRaiseText, runningLimits, payCapFlag, noPriceFits, cheaperText, limitNext, overLimitStep, logCause, SAFE_TEXT, causesLog, ADD_FUNDS_DONE_SHOWN_MS, addFundsShownName, MCP_TOOL_ALIASES, POOL_SWITCH_WHY, POOL_SWITCH_NEXT, SWITCH_STATES, quietSwitch, switchKey, ATOMIC_TEXT, MAX_PAYMENT_ATOMIC_LEAST, movedTo, FLOAT_ID2, ANSWERED_EXIT_RETRY_MS, ANSWERED_EXIT_UNCONFIRMED_MS, ANSWERED_EXIT_RETRY_WINDOW_MS, ANSWERED_EXIT_CLOSED, switchAmount, switchEta, switchRows, OWNER_CAP_CODES, JOIN_END_MCP, JOIN_END_TERMINAL_LIBRARY, JOIN_RETRY_BACKOFF_MS, WALLET_CAP_FIX, ENTRY_CAP_CODES, MCP_CAP_FIX, capFix, ownerOnlyNext, mcpNext, CONFIDENTIAL_RETIRED, json4, answerResult, discoverTool, LAUNCH_CAP_CODES, dayCapKind, refuse11, newRequestIdFor, payCapName, limitQuestion, stableJson, requestPrint, JSON_SNIFF_MAX_CHARS, publicOffer, FLOAT_PAID_CODES, FLOAT_NOT_CERTAIN_CODES, FLOAT_PRIVATE_LEG, SELLER_ONLY_HERE, outsideWalletRule, TOR_START_STEP, MONEY_ID2, toRecordId, linkKindOf, moneyId, FUNDING_REFUSAL_SCHEMA, fundingRefusalName, OTHER_WALLET_NEXT, REFUSED_CODES, SEND_STOPPED, SEND_STOP_NOT_SAVED, sendStoppedError, refusedCodeOf, PLAIN_REASONS, insufficientCause, INSUFFICIENT_REASONS, historyRefusalCode, reasonOf, plainReason, KEPT_SEND_TRIES, shownId, isSplitSend, PROMISED_NEXT, partFailReason, sendAnswerOf, PUBLIC_READ_TIMEOUT_MS, RECIPIENT_CHECK_TIMEOUT_MS, withTimeout, ownKey, readFailure, OWN_KEY_TOKENS_MAX, tokenAmountText, elsewhereId, PORTAL_DEPOSIT_ID, PORTAL_BLOCK_WORDS, isPortalBlocker, TERMINAL_PLAN_PREFIX, APP_LINK_PREFIX, cliPlanSplit, blockedByOf, AGENT_ID_SCHEMA, agentIdName, minutesText2, ageWords2, agoWords, DEPOSIT_SENT_STATES, depositLanded, usdcText3, walkWalletHistory, REFRESH_LEASE_WALK_MS, HOME_MARKS_SETTLED_MS2, AUTO_BACKUPS_KEPT, AUTO_BACKUP_NAME, AUTO_BACKUP_VERIFIED, FRONTED_SETTLE_MARGIN_SLOTS, RECIPIENT_READ_TOTAL_MS, RECIPIENT_READ_SLOW_MS, slowReadSaid, UNSHIELD_WINDOW_YIELD_MS, NOT_FINAL_YET, FINISH_FINALITY_WAIT_MS, FINISH_FINALITY_WAITS, FINISH_FINALITY_RECENT_MS, walkStillCurrent, DIRECT_EXIT_GONE, BALANCE_REFRESH_WAIT_MS, BALANCE_REFRESH_GRACE_MS, BALANCE_REFRESH_LONG_MS, INBOUND_REFRESH_AGE_MS, PAY_ME_STATUS_WALK_MS, REFUND_CHECK_MIN_MS, SALE_VIEW_AGE_SECONDS, saleViewRead, balanceTextFields, changeFields, balanceAnswer, REFRESH_RETRY_MS, FINALITY_POLL_MS, FINALITY_WAIT_MS, FINALITY_REFRESH_LIMIT_MS, FINALITY_CLOSE_WAIT_MS, POOL_WATCH_MS, POOL_WATCH_POLL_MS, EARLY_BALANCE_DELAY_MS, FINALITY_SETTLE_WINDOW_SLOTS, PUBLIC_READ_ANSWER_MS, OWN_READ_ANSWER_MS, RECEIPTS_ID_LOOKUP_MS, RECEIPTS_SEND_WAIT_MS, PRIVATE_ID_NOT_READ, LINK_READ_ANSWER_MS, OWN_READS_AHEAD_MS, OWN_PUBLIC_KNOWN_MS, OWN_READS_REUSE_MS, FLOAT_CORRECT_WAIT_MS, SWITCH_WAIT_MS, UNSHIELD_TO_NO_USDC_DETAIL, UNSHIELD_TO_INVALID_NEXT, ELICIT_TIMEOUT_MS, ALLOW_BOX_HOSTS, ALLOW_BOX_PROGRESS_MS, ELICIT_UNSHOWN_MS, elicitUnshown, ANSWER_ARRIVED_AT, monotonicNow, answerTimeOf, elicitTooFast, POLL_SECONDS2, TEMP_CLEAN_DELAY_MS, KEPT_ON_DISK, receiveGenerator, MCP_TOOL_NAMES, MCP_HIDDEN_TOOL_NAMES, setupTerminalNext, SETUP_RUNNING_SAY, SETUP_WAITING_SAY, ACCEPTED_NEXT, SETUP_RUNNING_NEXT, SETUP_ANSWER_WAIT_MS, SETUP_CONFIRMING_SAY, SETUP_CONFIRMING_NEXT, OWN_ADDRESS_QUESTION, OWN_ADDRESS_WHERE, OWN_ADDRESS_INVALID, hostSeesAnswer, HOST_CHAT_NOT_PRIVATE, PRIVATE_INFERENCE_WHY, RESTART_STEPS, HOST_BLOCKED_LINE, TOR_BROWSER_PORT, SETUP_TOR_TITLE, SETUP_TOR_WHY;
162112
+ var import_web3137, X402_V1_NEXT, shownCaps, shinjukuWord, SEND_RESULT_READ, sendQuestionNext, SEND_KEPT_ON_DISK, RELEASE_RETRY_MS, STAGE_WORDS2, slowReadWords, stageWords, INTERNAL_BALANCE_DETAIL, shownBreakdown, sessionLeftShown, RESOURCE_PAYMENT_WAL_PREFIX2, POOL_LAYOUT_CODE, POOL_LAYOUT_UPDATE, AI_ONION_UNAVAILABLE_SAY, USEPOD_VIA_INFERENCE_CHAT, TOR_ON_RESTART_SAY, askTorOnStep, SEND_RUNS_ON, DEPOSIT_RUNS_ON, CLI_FUNDS_PLAN_PREFIX, CLI_FUNDS_SCHEMA, SELF_PAY_ORIGIN3, REQUEST_ID4, POSITIVE_ATOMIC6, PRIVATE_HOST3, FORBIDDEN_HEADERS3, MAX_BODY_BYTES2, PREVIEW_SELLER_READ_MS, PREVIEW_BODY_OPEN_MS, CALL_BUDGET_MS, budgetLeft, PAY_ANSWER_MARGIN_MS, MONEY_FIRST_ANSWER_MS, HERMES_CALL_WAIT_MS, hermesLeft, TOOL_PLAIN_FIRST, UPDATE_CHECK_WAIT_MS, BALANCE_AFTER_LANDING_MS, JOIN_CALL_MAX_MS, JOIN_CALL_ANSWER_MARGIN_S, PAY_AFTER_JOIN_MS, joinAnswerSeconds, JOIN_TIME_MS, JOIN_NUDGE_QUIET_MS, SPEND_TOOLS, MOVES_WHILE_READING, USER_ACTION_TOOLS, JOIN_STEP_MS, sleep2, PROGRESS_EVERY_MS2, READ_BUDGET_MS, ASK_PRIVATE_TOOLS, TOR_WAIT_IN_CALL_MS, TOR_ANSWER_KEEP_MS, UNPAID_TOR_TRY_MS, UNPAID_TOR_OPEN_MS, UNPAID_CLEAR_MS, READ_BUDGET_TOOLS, FLOAT_BUSY_CODES, RETRY_MARGIN_MS, ASK_PAY_CODES, runningNpmVersion2, terminalCommand2, capPlaceWords, noLimitSetLine, CAP_NAMES, capName, entryPlaces, capRaiseText, runningLimits, payCapFlag, noPriceFits, cheaperText, limitNext, overLimitStep, logCause, SAFE_TEXT, causesLog, ADD_FUNDS_DONE_SHOWN_MS, addFundsShownName, MCP_TOOL_ALIASES, POOL_SWITCH_WHY, POOL_SWITCH_NEXT, SWITCH_STATES, quietSwitch, switchKey, ATOMIC_TEXT, MAX_PAYMENT_ATOMIC_LEAST, movedTo, FLOAT_ID2, ANSWERED_EXIT_RETRY_MS, ANSWERED_EXIT_UNCONFIRMED_MS, ANSWERED_EXIT_RETRY_WINDOW_MS, ANSWERED_EXIT_CLOSED, switchAmount, switchEta, switchRows, OWNER_CAP_CODES, JOIN_END_MCP, JOIN_END_TERMINAL_LIBRARY, JOIN_RETRY_BACKOFF_MS, WALLET_CAP_FIX, ENTRY_CAP_CODES, MCP_CAP_FIX, capFix, ownerOnlyNext, mcpNext, CONFIDENTIAL_RETIRED, json4, answerResult, discoverTool, LAUNCH_CAP_CODES, dayCapKind, refuse11, newRequestIdFor, payCapName, limitQuestion, stableJson, requestPrint, JSON_SNIFF_MAX_CHARS, publicOffer, FLOAT_PAID_CODES, FLOAT_NOT_CERTAIN_CODES, FLOAT_PRIVATE_LEG, SELLER_ONLY_HERE, outsideWalletRule, TOR_START_STEP, MONEY_ID2, toRecordId, linkKindOf, moneyId, FUNDING_REFUSAL_SCHEMA, fundingRefusalName, OTHER_WALLET_NEXT, REFUSED_CODES, SEND_STOPPED, SEND_STOP_NOT_SAVED, sendStoppedError, refusedCodeOf, PLAIN_REASONS, insufficientCause, INSUFFICIENT_REASONS, historyRefusalCode, reasonOf, plainReason, KEPT_SEND_TRIES, shownId, isSplitSend, PROMISED_NEXT, partFailReason, sendAnswerOf, PUBLIC_READ_TIMEOUT_MS, RECIPIENT_CHECK_TIMEOUT_MS, withTimeout, ownKey, readFailure, OWN_KEY_TOKENS_MAX, tokenAmountText, elsewhereId, PORTAL_DEPOSIT_ID, PORTAL_BLOCK_WORDS, isPortalBlocker, TERMINAL_PLAN_PREFIX, APP_LINK_PREFIX, cliPlanSplit, blockedByOf, AGENT_ID_SCHEMA, agentIdName, minutesText2, ageWords2, agoWords, DEPOSIT_SENT_STATES, depositLanded, usdcText3, walkWalletHistory, REFRESH_LEASE_WALK_MS, HOME_MARKS_SETTLED_MS2, AUTO_BACKUPS_KEPT, AUTO_BACKUP_NAME, AUTO_BACKUP_VERIFIED, FRONTED_SETTLE_MARGIN_SLOTS, RECIPIENT_READ_TOTAL_MS, RECIPIENT_READ_SLOW_MS, slowReadSaid, UNSHIELD_WINDOW_YIELD_MS, NOT_FINAL_YET, FINISH_FINALITY_WAIT_MS, FINISH_FINALITY_WAITS, FINISH_FINALITY_RECENT_MS, walkStillCurrent, DIRECT_EXIT_GONE, BALANCE_REFRESH_WAIT_MS, BALANCE_REFRESH_GRACE_MS, BALANCE_REFRESH_LONG_MS, INBOUND_REFRESH_AGE_MS, PAY_ME_STATUS_WALK_MS, REFUND_CHECK_MIN_MS, SALE_VIEW_AGE_SECONDS, saleViewRead, balanceTextFields, changeFields, balanceAnswer, REFRESH_RETRY_MS, FINALITY_POLL_MS, FINALITY_WAIT_MS, FINALITY_REFRESH_LIMIT_MS, FINALITY_CLOSE_WAIT_MS, POOL_WATCH_MS, POOL_WATCH_POLL_MS, POOL_WATCH_SLOW_MS, EARLY_BALANCE_DELAY_MS, FINALITY_SETTLE_WINDOW_SLOTS, PUBLIC_READ_ANSWER_MS, OWN_READ_ANSWER_MS, RECEIPTS_ID_LOOKUP_MS, RECEIPTS_SEND_WAIT_MS, PRIVATE_ID_NOT_READ, LINK_READ_ANSWER_MS, OWN_READS_AHEAD_MS, OWN_PUBLIC_KNOWN_MS, OWN_READS_REUSE_MS, FLOAT_CORRECT_WAIT_MS, SWITCH_WAIT_MS, UNSHIELD_TO_NO_USDC_DETAIL, UNSHIELD_TO_INVALID_NEXT, ELICIT_TIMEOUT_MS, ALLOW_BOX_HOSTS, ALLOW_BOX_PROGRESS_MS, ELICIT_UNSHOWN_MS, elicitUnshown, ANSWER_ARRIVED_AT, monotonicNow, answerTimeOf, elicitTooFast, POLL_SECONDS2, TEMP_CLEAN_DELAY_MS, KEPT_ON_DISK, receiveGenerator, MCP_TOOL_NAMES, MCP_HIDDEN_TOOL_NAMES, setupTerminalNext, SETUP_RUNNING_SAY, SETUP_WAITING_SAY, ACCEPTED_NEXT, SETUP_RUNNING_NEXT, SETUP_ANSWER_WAIT_MS, SETUP_CONFIRMING_SAY, SETUP_CONFIRMING_NEXT, OWN_ADDRESS_QUESTION, OWN_ADDRESS_WHERE, OWN_ADDRESS_INVALID, hostSeesAnswer, HOST_CHAT_NOT_PRIVATE, PRIVATE_INFERENCE_WHY, RESTART_STEPS, HOST_BLOCKED_LINE, TOR_BROWSER_PORT, SETUP_TOR_TITLE, SETUP_TOR_WHY;
162024
162113
  var init_tools = __esm({
162025
162114
  "wallet/src/mcp/tools.mjs"() {
162026
162115
  "use strict";
@@ -162676,6 +162765,7 @@ var init_tools = __esm({
162676
162765
  FINALITY_CLOSE_WAIT_MS = 2e4;
162677
162766
  POOL_WATCH_MS = 10 * 6e4;
162678
162767
  POOL_WATCH_POLL_MS = 2e4;
162768
+ POOL_WATCH_SLOW_MS = 5 * 6e4;
162679
162769
  EARLY_BALANCE_DELAY_MS = 50;
162680
162770
  FINALITY_SETTLE_WINDOW_SLOTS = 150;
162681
162771
  PUBLIC_READ_ANSWER_MS = 3e3;
@@ -167785,6 +167875,130 @@ function homeScreenNeeds() {
167785
167875
  }
167786
167876
  return { columns: MIN_COLUMNS, rows: 80 };
167787
167877
  }
167878
+ function jobLine(title, stream, env) {
167879
+ const codes = paletteFor(screenColor(stream, env));
167880
+ const classes = ["crim", "bone", "ash", "verm"];
167881
+ return [...JOB_LINE_WORDS, clean4(title)].map((text3, index) => codes ? `${codes[classes[index]]}${text3}${RESET2}` : text3).join("");
167882
+ }
167883
+ function sizeNow(stream) {
167884
+ try {
167885
+ const size = [0, 0];
167886
+ if (!stream._handle.getWindowSize(size) && size[0] > 0 && size[1] > 0) return { columns: size[0], rows: size[1] };
167887
+ } catch {
167888
+ }
167889
+ return { columns: stream.columns, rows: stream.rows };
167890
+ }
167891
+ function jobBarPin(title, stream, env) {
167892
+ const size = sizeNow(stream);
167893
+ if (!holdsJobBar(size.rows, size.columns, clean4(title))) return "";
167894
+ const { rows: rows2 } = size;
167895
+ const columns = Number.isSafeInteger(size.columns) ? size.columns : 80;
167896
+ const codes = paletteFor(screenColor(stream, env));
167897
+ const line = "\u2500".repeat(columns - 1);
167898
+ return `\x1B7\x1B[r\x1B8\x1BD\x1BD\x1B[2A\x1B7\x1B[1B\r\x1B[J\x1B[${rows2 - 1};1H${codes ? `${codes.ash}${line}${RESET2}` : line}\x1B[${rows2};1H${jobLine(title, stream, env)}\x1B[1;${rows2 - JOB_BAR_ROWS}r\x1B8`;
167899
+ }
167900
+ function keepJobBar({ title, stdout = process.stdout, stderr = process.stderr, env = process.env } = {}) {
167901
+ const name = title ?? env?.[JOB_BAR_ENV];
167902
+ if (!name) return () => {
167903
+ };
167904
+ const undo = [.../* @__PURE__ */ new Set([stdout, stderr])].filter((stream) => stream?.isTTY).map((stream) => {
167905
+ const before = stream.write;
167906
+ let on = true;
167907
+ let tail = "";
167908
+ let owed = false;
167909
+ const barWrite = function barWrite2(chunk, ...rest) {
167910
+ const result = before.call(stream, chunk, ...rest);
167911
+ if (!on) return result;
167912
+ const text3 = tail + (typeof chunk === "string" ? chunk : chunk instanceof Uint8Array ? Buffer.from(chunk).toString("latin1") : "");
167913
+ tail = ERASE_START.exec(text3)?.[0] ?? "";
167914
+ owed = owed || ERASE_DISPLAY.test(text3);
167915
+ if (!owed || ESCAPE_OPEN.test(text3)) return result;
167916
+ owed = false;
167917
+ const pin = jobBarPin(name, stream, env);
167918
+ if (pin) {
167919
+ try {
167920
+ before.call(stream, pin);
167921
+ } catch {
167922
+ }
167923
+ }
167924
+ return result;
167925
+ };
167926
+ stream.write = barWrite;
167927
+ return () => {
167928
+ on = false;
167929
+ if (stream.write === barWrite) stream.write = before;
167930
+ };
167931
+ });
167932
+ return () => undo.forEach((off) => off());
167933
+ }
167934
+ function holdJobBar({ title, stdout = process.stdout, env = process.env, proc = process } = {}) {
167935
+ const write = (text3) => {
167936
+ try {
167937
+ stdout.write(text3);
167938
+ } catch {
167939
+ }
167940
+ };
167941
+ env[JOB_BAR_ENV] = clean4(title);
167942
+ let held2 = true;
167943
+ let pinned = false;
167944
+ const pin = () => {
167945
+ const text3 = jobBarPin(title, stdout, env);
167946
+ if (!text3) return false;
167947
+ write(text3);
167948
+ pinned = true;
167949
+ return true;
167950
+ };
167951
+ const unpin = () => {
167952
+ if (!pinned) return;
167953
+ pinned = false;
167954
+ write("\x1B7\x1B[r\x1B8\x1BD\x1B7\r\x1B[J\x1B8\x1B[1A");
167955
+ };
167956
+ const onResize = () => {
167957
+ if (!pin()) unpin();
167958
+ };
167959
+ const stopSignals = ["SIGTERM", "SIGHUP"];
167960
+ const onStop = (signal) => {
167961
+ release();
167962
+ if (proc.listenerCount?.(signal) === 0) {
167963
+ try {
167964
+ proc.kill(proc.pid, signal);
167965
+ } catch {
167966
+ }
167967
+ }
167968
+ };
167969
+ pin();
167970
+ const dropHook = keepJobBar({ title, stdout, env });
167971
+ const sizeCheck = setInterval(() => {
167972
+ const now = sizeNow(stdout);
167973
+ if (now.rows === stdout.rows && now.columns === stdout.columns) return;
167974
+ try {
167975
+ stdout._refreshSize();
167976
+ } catch {
167977
+ }
167978
+ }, JOB_BAR_SIZE_CHECK_MS);
167979
+ sizeCheck.unref?.();
167980
+ try {
167981
+ stdout.on?.("resize", onResize);
167982
+ proc.once?.("exit", release);
167983
+ for (const signal of stopSignals) proc.on?.(signal, onStop);
167984
+ } catch {
167985
+ }
167986
+ function release() {
167987
+ if (!held2) return;
167988
+ held2 = false;
167989
+ clearInterval(sizeCheck);
167990
+ dropHook();
167991
+ unpin();
167992
+ delete env[JOB_BAR_ENV];
167993
+ try {
167994
+ stdout.removeListener?.("resize", onResize);
167995
+ proc.removeListener?.("exit", release);
167996
+ for (const signal of stopSignals) proc.removeListener?.(signal, onStop);
167997
+ } catch {
167998
+ }
167999
+ }
168000
+ return release;
168001
+ }
167788
168002
  async function runJobView({
167789
168003
  title,
167790
168004
  run: run2,
@@ -167792,7 +168006,9 @@ async function runJobView({
167792
168006
  stdin = process.stdin,
167793
168007
  env = process.env,
167794
168008
  launcherGone = launcherWatch(),
167795
- platform = process.platform
168009
+ platform = process.platform,
168010
+ pinLine = true,
168011
+ proc = process
167796
168012
  } = {}) {
167797
168013
  const codes = paletteFor(screenColor(stdout, env));
167798
168014
  const paint2 = (parts2) => parts2.map(([text3, cls]) => codes && cls ? `${codes[cls]}${text3}${RESET2}` : text3).join("");
@@ -167802,12 +168018,16 @@ async function runJobView({
167802
168018
  } catch {
167803
168019
  }
167804
168020
  };
167805
- const width = Math.max(20, (stdout.columns || 80) - 1);
167806
- const rule = paint2([["\u2500".repeat(width), "ash"]]);
167807
- write(`\x1B[0m\x1B[2J\x1B[H${paint2([["\u25C6 ", "crim"], ["shinjuku-shield", "bone"], [" \xB7 ", "ash"], [clean4(title), "verm"]])}
167808
- ${rule}
168021
+ const width = () => Math.max(20, (stdout.columns || 80) - 1);
168022
+ const rule = () => paint2([["\u2500".repeat(width()), "ash"]]);
168023
+ write(`\x1B[0m\x1B[2J\x1B[H${jobLine(title, stdout, env)}
168024
+ ${rule()}
167809
168025
 
167810
168026
  `);
168027
+ const canPin = pinLine && Boolean(stdout.isTTY);
168028
+ if (!canPin) delete env[JOB_BAR_ENV];
168029
+ const release = canPin ? holdJobBar({ title, stdout, env, proc }) : () => {
168030
+ };
167811
168031
  let code2;
167812
168032
  let endWords;
167813
168033
  try {
@@ -167826,21 +168046,25 @@ ${rule}
167826
168046
  }
167827
168047
  };
167828
168048
  const shellAgain = (first) => write(`${first ? `
167829
- ${"\u2500".repeat(width)}
168049
+ ${"\u2500".repeat(width())}
167830
168050
  ${end2.map(([text3]) => text3).join("")}
167831
168051
  ` : ""}The wallet screen has closed: the command that started it ended with the Ctrl+C.
167832
168052
  ` + (platform === "win32" ? 'If this window asks "Terminate batch job (Y/N)?", type Y and press Enter. ' : "") + "To open the wallet again, run the same command.\n");
167833
168053
  if (gone()) {
168054
+ release();
167834
168055
  shellAgain(true);
167835
168056
  return { code: code2, next: "quit", launcherGone: true };
167836
168057
  }
167837
168058
  write(`
167838
- ${rule}
168059
+ ${rule()}
167839
168060
  ${paint2(end2)}
167840
168061
  ${paint2([["press a job key, such as [l], to open that job at once", "bone"]])}
167841
168062
  ${paint2([["any other key, [q] too, goes back to the home screen", "mute"]])}
167842
168063
  `);
167843
- if (!stdin?.isTTY || typeof stdin.setRawMode !== "function") return { code: code2, next: "quit" };
168064
+ if (!stdin?.isTTY || typeof stdin.setRawMode !== "function") {
168065
+ release();
168066
+ return { code: code2, next: "quit" };
168067
+ }
167844
168068
  const rawBefore = Boolean(stdin.isRaw);
167845
168069
  let key;
167846
168070
  let ended2 = false;
@@ -167867,6 +168091,7 @@ ${paint2([["any other key, [q] too, goes back to the home screen", "mute"]])}
167867
168091
  stdin.setRawMode(rawBefore);
167868
168092
  } catch {
167869
168093
  }
168094
+ release();
167870
168095
  }
167871
168096
  if (ended2) {
167872
168097
  shellAgain(false);
@@ -167939,7 +168164,7 @@ async function waitForRoom({ stdout = process.stdout, stdin = process.stdin, env
167939
168164
  }
167940
168165
  }
167941
168166
  }
167942
- 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, LAUNCHER_POLL_MS, LAUNCHER_AT_LOAD, PARENT_AT_LOAD;
168167
+ 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, JOB_BAR_SIZE_CHECK_MS, ERASE_DISPLAY, ERASE_START, ESCAPE_OPEN, LAUNCHER_POLL_MS, LAUNCHER_AT_LOAD, PARENT_AT_LOAD;
167943
168168
  var init_homeScreen = __esm({
167944
168169
  "wallet/src/cli/homeScreen.mjs"() {
167945
168170
  "use strict";
@@ -168110,6 +168335,10 @@ var init_homeScreen = __esm({
168110
168335
  "below-least": "the least that can be made private is 0.01 USDC."
168111
168336
  };
168112
168337
  stackHeight = (blocks) => blocks.reduce((sum2, block) => sum2 + block.height, 0) + blocks.length - 1;
168338
+ JOB_BAR_SIZE_CHECK_MS = 500;
168339
+ ERASE_DISPLAY = /\x1b\[[0-3]?J/;
168340
+ ERASE_START = /\x1b(?:\[[0-3]?)?$/;
168341
+ ESCAPE_OPEN = /\x1b(?:\[[0-?]*[ -/]*|\][^\x07\x1b]*)?$/;
168113
168342
  LAUNCHER_POLL_MS = 250;
168114
168343
  LAUNCHER_AT_LOAD = /^[0-9]+$/.test(process.env[LAUNCHER_PID_ENV] ?? "") ? Number(process.env[LAUNCHER_PID_ENV]) : process.ppid;
168115
168344
  PARENT_AT_LOAD = process.ppid;
@@ -176532,7 +176761,7 @@ function showDepositQr(ctx, waiting) {
176532
176761
  if (typeof owner !== "string" || ctx.qrShown.has(owner)) continue;
176533
176762
  ctx.qrShown.add(owner);
176534
176763
  const link3 = payMeUri({ owner, mint: store.state.asset, decimals: Number(store.state.decimals ?? 6), amountAtomic: part.amountAtomic });
176535
- const rows2 = Number.isSafeInteger(process.stderr.rows) ? process.stderr.rows : void 0;
176764
+ const rows2 = Number.isSafeInteger(process.stderr.rows) ? jobRows(process.stderr.rows, process.env, process.stderr.columns) : void 0;
176536
176765
  const qr = qrTerminalText(qrLinkText(link3), rows2 !== void 0 ? { maxLines: rows2 - 7 } : {});
176537
176766
  const lines = [`Scan with your phone wallet (Solana Pay, USDC)${waiting.length > 1 ? `, ${usdc4(part.amountAtomic)} USDC to ${owner}` : ""}:`, qr, link3];
176538
176767
  ctx.io.err(`${lines.join("\n")}
@@ -184087,6 +184316,7 @@ ${result.error.message}` : ""}` };
184087
184316
  function commandUseLines(npmVersion) {
184088
184317
  if (!commandOnPath()) return terminalUseLinesHere(npmVersion);
184089
184318
  const older = npmVersion ? olderInstalledCommand(npmVersion) : void 0;
184319
+ if (!older && thisWindowLines("help").length) return thisWindowLines("help");
184090
184320
  if (!older) return [`In a terminal, run ${CLI_TYPED} help to see every command.`];
184091
184321
  return [`The shinjuku command on this computer is version ${older.installed}; this wallet is version ${older.current}. To update the command${older.plain ? " to the newest stable version" : ""}, run${older.plain ? "" : " this (it asks before it updates the command)"}:`, ` ${older.line}`];
184092
184322
  }
@@ -187637,7 +187867,7 @@ async function runPayMe(values, deps, io) {
187637
187867
  `);
187638
187868
  return;
187639
187869
  }
187640
- const rows2 = Number.isSafeInteger(process.stdout.rows) ? process.stdout.rows : void 0;
187870
+ const rows2 = Number.isSafeInteger(process.stdout.rows) ? jobRows(process.stdout.rows, deps.env, process.stdout.columns) : void 0;
187641
187871
  io.out([
187642
187872
  `Your pay-me link${view2.amount ? ` for ${view2.amount} USDC` : ""}. Send it to the person who pays you:`,
187643
187873
  "",
@@ -189769,7 +189999,13 @@ function defaultDependencies() {
189769
189999
  process.on("SIGINT", ignore);
189770
190000
  let child;
189771
190001
  try {
189772
- child = spawn13(process.execPath, [...process.execArgv, cliEntry2, ...args], { stdio: "inherit", env: { ...env, [HOME_JOB_ENV]: "1" } });
190002
+ const { [JOB_BAR_ENV]: left, ...childEnv } = env;
190003
+ const bar = process.env[JOB_BAR_ENV];
190004
+ child = spawn13(
190005
+ process.execPath,
190006
+ [...process.execArgv, cliEntry2, ...args],
190007
+ { stdio: "inherit", env: { ...childEnv, [HOME_JOB_ENV]: "1", ...bar ? { [JOB_BAR_ENV]: bar } : {} } }
190008
+ );
189773
190009
  } catch {
189774
190010
  process.removeListener("SIGINT", ignore);
189775
190011
  done(1);
@@ -189784,8 +190020,11 @@ function defaultDependencies() {
189784
190020
  done(code2 === 3221225786 || code2 === -1073741510 ? 130 : code2 ?? (signal ? 130 : 1));
189785
190021
  });
189786
190022
  }),
189787
- /** A home key's job view (cli/homeScreen.mjs runJobView): { code, next: "back" | "quit" }. */
189788
- homeJobView: (title, run2) => runJobView({ title, run: run2 }),
190023
+ /**
190024
+ * A home key's job view (cli/homeScreen.mjs runJobView): { code, next: "back" | "quit" }. Its Shinjuku line holds
190025
+ * the bottom of the window while the job's text scrolls above it (pinLine).
190026
+ */
190027
+ homeJobView: (title, run2, { pinLine } = {}) => runJobView({ title, run: run2, pinLine }),
189789
190028
  /** A window too small for the screen: "room" when it grew enough, "quit" (q), "off" (no terminal keys). */
189790
190029
  homeWaitForRoom: (env) => waitForRoom({ env }),
189791
190030
  /** The home screen's [o] and [b] keys show only when this build has their jobs (homeScreen.mjs homeKeys). */
@@ -190188,9 +190427,10 @@ async function homeKeyJob(key, { data, argv: argv2, deps }) {
190188
190427
  if (key !== "c") return 0;
190189
190428
  const hostNames = HOST_NAMES;
190190
190429
  const other = HOST_TARGETS.length + 1;
190430
+ const numbered = (number2) => String(number2).padStart(String(other).length);
190191
190431
  io.err(`Which agent app gets the wallet?
190192
- ${HOST_TARGETS.map((host, index) => ` ${index + 1} ${hostNames[host] ?? host}`).join("\n")}
190193
- ${other} another app (not in this list)
190432
+ ${HOST_TARGETS.map((host, index) => ` ${numbered(index + 1)} ${hostNames[host] ?? host}`).join("\n")}
190433
+ ${numbered(other)} another app (not in this list)
190194
190434
  `);
190195
190435
  for (; ; ) {
190196
190436
  const answer = String(await deps.ask(`Type its number (1 to ${other}), or press Enter to stop: `)).trim();
@@ -190220,7 +190460,7 @@ ${HOST_TARGETS.map((host, index) => ` ${index + 1} ${hostNames[host] ?? host}`
190220
190460
  const home = setupHome(deps.env);
190221
190461
  const npmVersion = deps.walletVersion().npm;
190222
190462
  const hosts = await addToHosts([host], home, deps, { npmVersion, ask: deps.stdinIsTTY() ? deps.ask : void 0 });
190223
- if (hosts.kept.has(host)) return 0;
190463
+ if (hosts.kept.has(host)) return { code: 0, ended: "nothing was changed" };
190224
190464
  if (hosts.added.has(host)) {
190225
190465
  io.out(`Next: ask ${hostNames[host]} "what is my Shinjuku balance".
190226
190466
  `);
@@ -190245,15 +190485,19 @@ ${HOST_TARGETS.map((host, index) => ` ${index + 1} ${hostNames[host] ?? host}`
190245
190485
  return 130;
190246
190486
  }
190247
190487
  }
190488
+ var SETUP_TITLE = "set up the wallet";
190248
190489
  function setupThemeFor(values, deps) {
190249
190490
  if (!setupThemeOn({ env: deps.env, interactive: !values.has("--yes"), stdinIsTTY: deps.stdinIsTTY() })) return void 0;
190250
190491
  const paint2 = setupPainter({ env: deps.env });
190251
190492
  const top = !values.has("--yes") && deps.env[SETUP_THEME_ENV] !== "1" && deps.env[HOME_JOB_ENV] !== "1";
190493
+ let dropBar = () => {
190494
+ };
190252
190495
  if (top) {
190253
- deps.io.out(setupHeader(paint2, process.stdout.columns));
190496
+ deps.io.out(setupHeader(paint2, process.stdout.columns, SETUP_TITLE));
190254
190497
  deps.env[SETUP_THEME_ENV] = "1";
190498
+ if (process.stdout.isTTY) dropBar = holdJobBar({ title: SETUP_TITLE, env: deps.env });
190255
190499
  }
190256
- return { io: themedIo(deps.io, paint2), ask: themedAsk(deps.ask, paint2), paint: paint2, top };
190500
+ return { io: themedIo(deps.io, paint2), ask: themedAsk(deps.ask, paint2), paint: paint2, top, dropBar };
190257
190501
  }
190258
190502
  async function openShinjukuAfterSetup(argv2, deps, theme2) {
190259
190503
  delete deps.env[SETUP_THEME_ENV];
@@ -190267,11 +190511,16 @@ async function openShinjukuAfterSetup(argv2, deps, theme2) {
190267
190511
  theme2.io.out("\n");
190268
190512
  }
190269
190513
  if (/^n(o)?$/i.test(answer)) {
190270
- theme2.io.out(`To open Shinjuku later, type:
190514
+ const here4 = thisWindowLines();
190515
+ theme2.io.out(here4.length ? `To open Shinjuku later:
190516
+ ${here4.join("\n")}
190517
+ ` : `To open Shinjuku later, type:
190271
190518
  ${cli4()}
190272
190519
  `);
190520
+ theme2.dropBar();
190273
190521
  return 0;
190274
190522
  }
190523
+ theme2.dropBar();
190275
190524
  const connection = argv2.flatMap((word2, index) => word2 === "--tor" || word2 === "--no-tor" ? [word2] : word2 === "--proxy" && argv2[index + 1] ? [word2, argv2[index + 1]] : []);
190276
190525
  return runHomeLoop(connection, deps, { animation: false, drawn: true });
190277
190526
  }
@@ -190338,7 +190587,13 @@ async function homeLoop(argv2, deps, { animation }) {
190338
190587
  await balanceRead?.finish(io);
190339
190588
  ranJob = true;
190340
190589
  const shown = facts.current();
190341
- const view2 = await deps.homeJobView(HOME_JOB_TITLES[screen.key] ?? "wallet", () => homeKeyJob(screen.key, { data: shown, argv: argv2, deps }));
190590
+ const view2 = await deps.homeJobView(
190591
+ HOME_JOB_TITLES[screen.key] ?? "wallet",
190592
+ () => homeKeyJob(screen.key, { data: shown, argv: argv2, deps }),
190593
+ // session-made, compet, 2026-11-20: the private chat draws its own hint row under the cursor (inference/chat.mjs);
190594
+ // it was not looked at with the held rows, so it runs without them.
190595
+ { pinLine: screen.key !== "t" }
190596
+ );
190342
190597
  if (screen.key === "i") localAi.forget();
190343
190598
  if (view2.next === "quit") return view2.code === 130 ? 130 : 0;
190344
190599
  nextKey = view2.key;
@@ -190359,6 +190614,10 @@ async function runShinjukuWallet(argv2, overrides = {}) {
190359
190614
  const themed = endsProcess && themedCommand(name, args) && terminalThemeOn({ stdout: stream, env: deps.env });
190360
190615
  const unTheme = themed ? themeStreams(setupPainter({ stdout: stream, env: deps.env }), dataOut ? [process.stderr] : void 0) : () => {
190361
190616
  };
190617
+ const heldByParent = endsProcess && (inHomeJob(deps.env) || deps.env[SETUP_THEME_ENV] === "1");
190618
+ if (endsProcess && !heldByParent) delete deps.env[JOB_BAR_ENV];
190619
+ const dropBar = heldByParent ? keepJobBar({ env: deps.env }) : () => {
190620
+ };
190362
190621
  const designOut = dataOut ? io.err : io.out;
190363
190622
  const topRun = themed && deps.env[THEME_CHILD_ENV] !== "1" && deps.env[HOME_JOB_ENV] !== "1";
190364
190623
  const ownTop = topRun && !(name === "setup" && !args.includes("--yes"));
@@ -190371,6 +190630,7 @@ async function runShinjukuWallet(argv2, overrides = {}) {
190371
190630
  return await runCommandLine(argv2, deps, { name, args, endsProcess });
190372
190631
  } finally {
190373
190632
  if (ownTop) designOut(commandFooter(stream.columns, { stream, env: deps.env }));
190633
+ dropBar();
190374
190634
  unTheme();
190375
190635
  }
190376
190636
  }