shinjuku-shield 0.3.168 → 0.3.169
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 +6 -6
- package/manifest.json +4 -4
- package/package.json +3 -3
- package/shinjuku-wallet.mjs +163 -40
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.
|
|
9
|
+
This is version 0.3.169. 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.
|
|
15
|
+
npm install -g shinjuku@0.3.169
|
|
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.
|
|
21
|
+
installing, type `npx shinjuku@0.3.169 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.
|
|
39
|
+
claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.169 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.
|
|
45
|
+
{ "mcpServers": { "shinjuku": { "command": "npx", "args": ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.169", "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.
|
|
58
|
+
args = ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.169", "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": "
|
|
5
|
-
"bytes":
|
|
6
|
-
"sourceCommit": "
|
|
4
|
+
"sha256": "9ade26e6a05c6891180751fdd695d76a8fef6376a8636b2c975b622192ac0002",
|
|
5
|
+
"bytes": 9313549,
|
|
6
|
+
"sourceCommit": "050b7443c989e9dcbd17e5a4037d6e9df3b07fb9",
|
|
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-
|
|
1041
|
+
"publishedAt": "2026-11-05T05:54:41.608Z"
|
|
1042
1042
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinjuku-shield",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.169",
|
|
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": "
|
|
7
|
-
"shinjukuSha256": "
|
|
6
|
+
"shinjukuRelease": "9ade26e6",
|
|
7
|
+
"shinjukuSha256": "9ade26e6a05c6891180751fdd695d76a8fef6376a8636b2c975b622192ac0002",
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
9
9
|
"author": "Shinjuku Shielded",
|
|
10
10
|
"homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
|
package/shinjuku-wallet.mjs
CHANGED
|
@@ -54233,9 +54233,8 @@ function setAsideNow(home, now) {
|
|
|
54233
54233
|
if (Array.isArray(loose.unshieldTo) && loose.unshieldTo.length >= 1 && loose.unshieldTo.length <= MAX_OWN_ADDRESSES && loose.unshieldTo.every(isPubkey)) {
|
|
54234
54234
|
salvaged.unshieldTo = [...loose.unshieldTo];
|
|
54235
54235
|
}
|
|
54236
|
-
|
|
54237
|
-
|
|
54238
|
-
}
|
|
54236
|
+
if (typeof loose.recoveryFile === "string" && isAbsolute2(loose.recoveryFile)) salvaged.recoveryFile = loose.recoveryFile;
|
|
54237
|
+
if (typeof loose.passphraseFile === "string" && isAbsolute2(loose.passphraseFile) && existsSync(loose.passphraseFile)) salvaged.passphraseFile = loose.passphraseFile;
|
|
54239
54238
|
if (!Object.keys(salvaged).length) return { keptAs, salvaged: void 0 };
|
|
54240
54239
|
writeFileSync(salvagePath(home), `${JSON.stringify(salvaged, null, 2)}
|
|
54241
54240
|
`, { mode: 384 });
|
|
@@ -126015,7 +126014,7 @@ function backupRecord(home) {
|
|
|
126015
126014
|
try {
|
|
126016
126015
|
const record = JSON.parse(readFileSync(backupRecordFile(home), "utf8"));
|
|
126017
126016
|
const config = readSetupConfig(home);
|
|
126018
|
-
if (!record?.savedAt || !config
|
|
126017
|
+
if (!record?.savedAt || !config || record.recoveryFile !== recoveryKey(config)) return null;
|
|
126019
126018
|
return {
|
|
126020
126019
|
savedAt: record.savedAt,
|
|
126021
126020
|
folder: record.folder,
|
|
@@ -126448,7 +126447,7 @@ function restrictFolderToOwner(folder, platform) {
|
|
|
126448
126447
|
function writeRecord(home, fields) {
|
|
126449
126448
|
const config = readSetupConfig(home);
|
|
126450
126449
|
const temp = `${backupRecordFile(home)}.${randomBytes24(4).toString("hex")}.tmp`;
|
|
126451
|
-
writeFileSync(temp, `${JSON.stringify({ ...fields, recoveryFile:
|
|
126450
|
+
writeFileSync(temp, `${JSON.stringify({ ...fields, recoveryFile: recoveryKey(config) }, null, 2)}
|
|
126452
126451
|
`, { mode: 384, flag: "wx" });
|
|
126453
126452
|
renameSync(temp, backupRecordFile(home));
|
|
126454
126453
|
}
|
|
@@ -126456,7 +126455,7 @@ function backupSkipped(home) {
|
|
|
126456
126455
|
try {
|
|
126457
126456
|
const record = JSON.parse(readFileSync(backupRecordFile(home), "utf8"));
|
|
126458
126457
|
const config = readSetupConfig(home);
|
|
126459
|
-
return Boolean(record?.skippedAt) && Boolean(config
|
|
126458
|
+
return Boolean(record?.skippedAt) && Boolean(config) && record.recoveryFile === recoveryKey(config);
|
|
126460
126459
|
} catch {
|
|
126461
126460
|
return false;
|
|
126462
126461
|
}
|
|
@@ -126465,7 +126464,11 @@ function recordBackupSkip(home) {
|
|
|
126465
126464
|
if (backupRecord(home)?.cleared) return;
|
|
126466
126465
|
writeRecord(home, { skippedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
126467
126466
|
}
|
|
126468
|
-
|
|
126467
|
+
function recordKeptCopy(home) {
|
|
126468
|
+
if (backupRecord(home)?.cleared) return;
|
|
126469
|
+
writeRecord(home, { skippedAt: (/* @__PURE__ */ new Date()).toISOString(), keptElsewhere: true });
|
|
126470
|
+
}
|
|
126471
|
+
var backupRecordFile, sha256Of, isFolder, backupFailed, canBackUp, CLOUD_WORDS, NETWORK_PLACE_WORDS, MOVED_WORDS, WINDOWS_RESERVED, samePath, UNKNOWN_DRIVE_WORDS, NETWORK_FS, LOCAL_FS, LINK_WORDS, SYSTEM_SID, ADMINISTRATORS_SID, recoveryKey, backupNeeded;
|
|
126469
126472
|
var init_backup = __esm({
|
|
126470
126473
|
"wallet/src/setup/backup.mjs"() {
|
|
126471
126474
|
"use strict";
|
|
@@ -126522,14 +126525,23 @@ var init_backup = __esm({
|
|
|
126522
126525
|
LINK_WORDS = (place) => `a part of ${place} is a link to another place (a junction or a symbolic link), so the wallet does not save the backup there. Pick a USB drive or a normal folder`;
|
|
126523
126526
|
SYSTEM_SID = "S-1-5-18";
|
|
126524
126527
|
ADMINISTRATORS_SID = "S-1-5-32-544";
|
|
126525
|
-
|
|
126528
|
+
recoveryKey = (config) => typeof config?.recoveryFile === "string" ? basename7(config.recoveryFile) : "none";
|
|
126529
|
+
backupNeeded = (home) => {
|
|
126530
|
+
let config;
|
|
126531
|
+
try {
|
|
126532
|
+
config = readSetupConfig(home);
|
|
126533
|
+
} catch {
|
|
126534
|
+
return false;
|
|
126535
|
+
}
|
|
126536
|
+
return Boolean(config) && backupRecord(home)?.cleared !== true && !backupSkipped(home);
|
|
126537
|
+
};
|
|
126526
126538
|
}
|
|
126527
126539
|
});
|
|
126528
126540
|
|
|
126529
126541
|
// wallet/src/mcp/backupTool.mjs
|
|
126530
126542
|
import { resolve as resolve26 } from "node:path";
|
|
126531
126543
|
function createBackup({ home, client, elicitTimeoutMs, unshown = () => false, log = () => {
|
|
126532
|
-
}, platform, env } = {}) {
|
|
126544
|
+
}, platform, env, setupLine: setupLine2 = "shinjuku setup" } = {}) {
|
|
126533
126545
|
const note = (line) => {
|
|
126534
126546
|
try {
|
|
126535
126547
|
log(line);
|
|
@@ -126605,10 +126617,61 @@ function createBackup({ home, client, elicitTimeoutMs, unshown = () => false, lo
|
|
|
126605
126617
|
next: code2 ? `Say this to the user word for word, with the code (the user needs the code to add money): "${say3}" Only when the user says that code back, call wallet_backup with code set to it; never send the code yourself. A USB stick needs no code.` : "Tell the user where the backup is. Deposits can go on now (call wallet_add_funds if the user asked for it)."
|
|
126606
126618
|
});
|
|
126607
126619
|
}
|
|
126620
|
+
async function askKeptInBox(target, signal) {
|
|
126621
|
+
if (!client?.canElicit?.()) return { why: "unsupported" };
|
|
126622
|
+
const askedAt = Date.now();
|
|
126623
|
+
let answer;
|
|
126624
|
+
try {
|
|
126625
|
+
answer = await client.elicit({ message: KEPT_MESSAGE, requestedSchema: { type: "object", properties: {
|
|
126626
|
+
kept: { type: "string", title: "A copy of the recovery file", enum: [KEPT, SKIP], enumNames: [KEPT_WORDS, SKIP_WORDS] }
|
|
126627
|
+
}, required: ["kept"] } }, elicitTimeoutMs, signal);
|
|
126628
|
+
} catch (error) {
|
|
126629
|
+
if (error?.cancelled === true) return { why: "cancelled" };
|
|
126630
|
+
return { why: error?.timedOut === true ? "timeout" : unshown(askedAt) ? "unsupported" : "error" };
|
|
126631
|
+
}
|
|
126632
|
+
if (answer?.action !== "accept") return { why: unshown(askedAt, answer) ? "unsupported" : "declined" };
|
|
126633
|
+
if (answer.content?.kept === KEPT) {
|
|
126634
|
+
recordKeptCopy(target);
|
|
126635
|
+
note("MCP_BACKUP_KEPT box");
|
|
126636
|
+
return { kept: true };
|
|
126637
|
+
}
|
|
126638
|
+
if (answer.content?.kept === SKIP) {
|
|
126639
|
+
recordBackupSkip(target);
|
|
126640
|
+
note("MCP_BACKUP_SKIPPED box");
|
|
126641
|
+
return { skipped: true };
|
|
126642
|
+
}
|
|
126643
|
+
return { why: "no_place" };
|
|
126644
|
+
}
|
|
126645
|
+
const keptInTerminal = (toolName, asked) => json2({
|
|
126646
|
+
say: `${KEPT_SAY} To answer, open a terminal and run: ${setupLine2}`,
|
|
126647
|
+
ok: false,
|
|
126648
|
+
error: "backup_needed",
|
|
126649
|
+
detail: "this wallet's recovery file is not on this computer and the user has not said that a copy is kept, so no deposit address was made; nothing was moved",
|
|
126650
|
+
next: `${boxWords(asked)}Tell the user, in these words: "${KEPT_SAY} To answer, open a terminal and run: ${setupLine2}" The terminal asks whether the user keeps a copy; you cannot answer it. Then call ${toolName} again.`
|
|
126651
|
+
});
|
|
126652
|
+
async function keptGate(target, toolName, signal) {
|
|
126653
|
+
const asked = await askKeptInBox(target, signal);
|
|
126654
|
+
if (asked.kept) return { lead: KEPT_LEAD };
|
|
126655
|
+
if (asked.skipped) return { lead: "No backup was recorded." };
|
|
126656
|
+
note(`MCP_BACKUP_NEEDED ${toolName} kept-${asked.why}`);
|
|
126657
|
+
return { refusal: keptInTerminal(toolName, asked) };
|
|
126658
|
+
}
|
|
126659
|
+
async function keptRun(target, signal) {
|
|
126660
|
+
const asked = await askKeptInBox(target, signal);
|
|
126661
|
+
if (asked.kept) return json2({ say: KEPT_LEAD, ok: true, kept: true, next: "The user answered in a box in this app. Deposits can go on now." });
|
|
126662
|
+
if (asked.skipped) return json2({
|
|
126663
|
+
say: "No backup was recorded. If this computer breaks, the money is lost.",
|
|
126664
|
+
ok: true,
|
|
126665
|
+
skipped: true,
|
|
126666
|
+
next: "The user chose no backup in a box in this app. Deposits can go on now."
|
|
126667
|
+
});
|
|
126668
|
+
return keptInTerminal("wallet_add_funds", asked);
|
|
126669
|
+
}
|
|
126608
126670
|
const boxWords = (asked) => asked.why === "failed" ? `The backup was not saved: ${asked.plain}. ` : asked.why === "declined" ? "The user closed the backup box without a choice. " : asked.why === "no_place" ? "The backup box came back with no place picked. " : asked.why === "timeout" ? "The backup box got no answer in time. " : "";
|
|
126609
126671
|
async function gate(toolName, signal) {
|
|
126610
126672
|
const target = home();
|
|
126611
126673
|
if (!target || !backupNeeded(target)) return void 0;
|
|
126674
|
+
if (!canBackUp(target)) return keptGate(target, toolName, signal);
|
|
126612
126675
|
const asked = await askInBox(target, signal);
|
|
126613
126676
|
if (asked.saved) return { lead: savedLine(asked.saved, asked.removable) };
|
|
126614
126677
|
if (asked.skipped) return { lead: "No backup was saved." };
|
|
@@ -126635,7 +126698,7 @@ function createBackup({ home, client, elicitTimeoutMs, unshown = () => false, lo
|
|
|
126635
126698
|
const tool = {
|
|
126636
126699
|
name: "wallet_backup",
|
|
126637
126700
|
title: "Save a backup of the wallet (to a USB stick)",
|
|
126638
|
-
description: "Use this when the user asks to save or make a backup of the wallet (for example 'save my backup'), and before the first deposit: wallet_add_funds makes no address until a backup is saved or the user skips it. It copies the wallet's recovery file and passphrase file into a new folder at a place the user picks (a USB stick is best), checks each copy, and says where. With no arguments it shows the places in a box in this app (the user can also pick Skip there), or lists them (numbered, USB sticks first). place: the number from that list, or a folder the user names (in an app with a box, the box opens with it chosen). code: only the code the user says back after a backup to a folder on this computer. Moves no money. Refusals: backup_failed, backup_unavailable.",
|
|
126701
|
+
description: "Use this when the user asks to save or make a backup of the wallet (for example 'save my backup'), and before the first deposit: wallet_add_funds makes no address until a backup is saved or the user skips it. It copies the wallet's recovery file and passphrase file into a new folder at a place the user picks (a USB stick is best), checks each copy, and says where. With no arguments it shows the places in a box in this app (the user can also pick Skip there), or lists them (numbered, USB sticks first). place: the number from that list, or a folder the user names (in an app with a box, the box opens with it chosen). code: only the code the user says back after a backup to a folder on this computer. Moves no money. Refusals: backup_failed, backup_unavailable, backup_needed.",
|
|
126639
126702
|
inputSchema: {
|
|
126640
126703
|
type: "object",
|
|
126641
126704
|
properties: {
|
|
@@ -126647,6 +126710,7 @@ function createBackup({ home, client, elicitTimeoutMs, unshown = () => false, lo
|
|
|
126647
126710
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
126648
126711
|
async run(args = {}, { signal } = {}) {
|
|
126649
126712
|
const target = home();
|
|
126713
|
+
if (target && !canBackUp(target) && backupNeeded(target)) return keptRun(target, signal);
|
|
126650
126714
|
if (!target || !canBackUp(target)) {
|
|
126651
126715
|
const record = target ? backupRecord(target) : null;
|
|
126652
126716
|
return json2({
|
|
@@ -126716,7 +126780,7 @@ function createBackup({ home, client, elicitTimeoutMs, unshown = () => false, lo
|
|
|
126716
126780
|
};
|
|
126717
126781
|
return { tool, gate };
|
|
126718
126782
|
}
|
|
126719
|
-
var BACKUP_FIRST_SAY, SKIP, SKIP_WORDS, json2, savedLine;
|
|
126783
|
+
var BACKUP_FIRST_SAY, SKIP, SKIP_WORDS, json2, KEPT, KEPT_WORDS, KEPT_MESSAGE, KEPT_SAY, KEPT_LEAD, savedLine;
|
|
126720
126784
|
var init_backupTool = __esm({
|
|
126721
126785
|
"wallet/src/mcp/backupTool.mjs"() {
|
|
126722
126786
|
"use strict";
|
|
@@ -126725,6 +126789,11 @@ var init_backupTool = __esm({
|
|
|
126725
126789
|
SKIP = "skip";
|
|
126726
126790
|
SKIP_WORDS = "Skip: no backup (you can lose your money if this computer breaks)";
|
|
126727
126791
|
json2 = (value2) => ({ text: JSON.stringify(value2, null, 2) });
|
|
126792
|
+
KEPT = "kept";
|
|
126793
|
+
KEPT_WORDS = "Yes: I keep a copy in a safe place (a USB stick or another computer)";
|
|
126794
|
+
KEPT_MESSAGE = "Your wallet's recovery file is not on this computer any more. It is the only way to get your money back if this computer breaks or is lost. Do you keep a copy of it in a safe place?";
|
|
126795
|
+
KEPT_SAY = "Your wallet's recovery file is not on this computer any more. Before you add money: do you keep a copy of it in a safe place?";
|
|
126796
|
+
KEPT_LEAD = "You keep a copy of your recovery file: that copy is your backup.";
|
|
126728
126797
|
savedLine = (saved, removable) => `Backup saved to ${saved.folder} (${saved.files.length} files, each checked).` + (removable === false ? " It is on this computer: copy that folder to a USB stick too." : "") + (saved.warning ? ` ${saved.warning}` : "");
|
|
126729
126798
|
}
|
|
126730
126799
|
});
|
|
@@ -141303,7 +141372,8 @@ ${canonical5}`;
|
|
|
141303
141372
|
client,
|
|
141304
141373
|
elicitTimeoutMs,
|
|
141305
141374
|
unshown: elicitUnshown,
|
|
141306
|
-
log
|
|
141375
|
+
log,
|
|
141376
|
+
setupLine: terminalCommand2("setup")
|
|
141307
141377
|
});
|
|
141308
141378
|
const withBackupFirst = (tool) => ({ ...tool, run: async (args, ctx = {}) => {
|
|
141309
141379
|
const held = await backup.gate(tool.name, ctx.signal);
|
|
@@ -141553,14 +141623,14 @@ ${JSON.stringify(args ?? {})}`;
|
|
|
141553
141623
|
withConfirmedSend(unshield),
|
|
141554
141624
|
cancel,
|
|
141555
141625
|
receipts,
|
|
141556
|
-
shield,
|
|
141626
|
+
withBackupFirst(shield),
|
|
141557
141627
|
withBackupFirst(fromElsewhere),
|
|
141558
141628
|
withBackupFirst(payMe),
|
|
141559
141629
|
payMeStatus,
|
|
141560
141630
|
unshieldCancel,
|
|
141561
141631
|
moveStatus,
|
|
141562
141632
|
receiveShielded,
|
|
141563
|
-
transferToken,
|
|
141633
|
+
withBackupFirst(transferToken),
|
|
141564
141634
|
transferTokenStatus,
|
|
141565
141635
|
inferenceServer,
|
|
141566
141636
|
inferenceModels,
|
|
@@ -150404,7 +150474,7 @@ async function runSetupSteps(options, deps, toolsSignal) {
|
|
|
150404
150474
|
const pending = old?.recoveryFile && existsSync(old.recoveryFile) ? old.recoveryFile : journaled?.pool === identity.pool && typeof journaled.recoveryFile === "string" && existsSync(journaled.recoveryFile) ? journaled.recoveryFile : recoveryFileOf(home, store.state.seedHex);
|
|
150405
150475
|
wallet = { status: "existing", ...pending ? { recoveryFile: pending } : {} };
|
|
150406
150476
|
} else {
|
|
150407
|
-
const
|
|
150477
|
+
const recoveryFile2 = join36(home, `recovery-${now().toISOString().replace(/[:.]/g, "-")}.txt`);
|
|
150408
150478
|
let memoStartIndex;
|
|
150409
150479
|
try {
|
|
150410
150480
|
memoStartIndex = await (deps.readMemoStartIndex ?? readMemoStartIndex)({ facilitator, identity, ...deps.env ? { env: deps.env } : {}, ...deps.fetchImpl ? { fetchImpl: deps.fetchImpl } : {} });
|
|
@@ -150414,7 +150484,7 @@ async function runSetupSteps(options, deps, toolsSignal) {
|
|
|
150414
150484
|
if (memoStartIndex === void 0) {
|
|
150415
150485
|
warnings.push("the pool's size could not be read before the wallet was made, so its first balance reads every memo of the pool (slower, same balance)");
|
|
150416
150486
|
}
|
|
150417
|
-
writeSetupJournal(home, { pool: identity.pool, recoveryFile, at: now().toISOString() });
|
|
150487
|
+
writeSetupJournal(home, { pool: identity.pool, recoveryFile: recoveryFile2, at: now().toISOString() });
|
|
150418
150488
|
const created = await deps.init({ home, passphrase: passphrase2, args: [
|
|
150419
150489
|
"init",
|
|
150420
150490
|
"--pool",
|
|
@@ -150430,23 +150500,24 @@ async function runSetupSteps(options, deps, toolsSignal) {
|
|
|
150430
150500
|
"--max-cumulative",
|
|
150431
150501
|
caps.maxTotal,
|
|
150432
150502
|
"--backup-out",
|
|
150433
|
-
|
|
150503
|
+
recoveryFile2,
|
|
150434
150504
|
...memoStartIndex !== void 0 ? ["--memo-start-index", memoStartIndex] : []
|
|
150435
150505
|
] });
|
|
150436
150506
|
wallet = {
|
|
150437
150507
|
status: "created",
|
|
150438
|
-
recoveryFile,
|
|
150508
|
+
recoveryFile: recoveryFile2,
|
|
150439
150509
|
solanaFeePayer: created?.solanaFeePayer,
|
|
150440
150510
|
seedFingerprint: created?.seedFingerprint,
|
|
150441
150511
|
...memoStartIndex !== void 0 ? { memoStartIndex } : {}
|
|
150442
150512
|
};
|
|
150443
|
-
onStage("wallet-created", { recoveryFile });
|
|
150513
|
+
onStage("wallet-created", { recoveryFile: recoveryFile2 });
|
|
150444
150514
|
}
|
|
150445
150515
|
let previousPools = movedFrom ? withPreviousPool(old) : old?.pool === identity.pool ? old.previousPools : void 0;
|
|
150446
150516
|
const drainingHere = (releasePools?.migration?.from ?? []).filter((entry) => entry.pool !== identity.pool && existsSync(homeWalletPath(home, entry.pool)) && !(previousPools ?? []).some((known) => known.pool === entry.pool));
|
|
150447
150517
|
if (drainingHere.length) previousPools = [...previousPools ?? [], ...drainingHere.map((entry) => ({ pool: entry.pool, program: entry.programId }))].slice(-8);
|
|
150448
150518
|
const torTunnel = tor ? options.torTunnel ?? old?.torTunnel : void 0;
|
|
150449
150519
|
const unshieldTo = old?.unshieldTo ? [...old.unshieldTo] : [];
|
|
150520
|
+
const recoveryFile = wallet.recoveryFile ?? (typeof old?.recoveryFile === "string" ? old.recoveryFile : void 0);
|
|
150450
150521
|
const base = {
|
|
150451
150522
|
schema: CONFIG_SCHEMA,
|
|
150452
150523
|
...identity,
|
|
@@ -150456,7 +150527,7 @@ async function runSetupSteps(options, deps, toolsSignal) {
|
|
|
150456
150527
|
tor,
|
|
150457
150528
|
...torTunnel ? { torTunnel } : {},
|
|
150458
150529
|
...unshieldTo.length ? { unshieldTo } : {},
|
|
150459
|
-
...
|
|
150530
|
+
...recoveryFile ? { recoveryFile } : {},
|
|
150460
150531
|
...previousPools?.length ? { previousPools } : {}
|
|
150461
150532
|
};
|
|
150462
150533
|
if (movedFrom) {
|
|
@@ -159767,6 +159838,8 @@ async function recordOwnAddress(home, address4, deps) {
|
|
|
159767
159838
|
return [` note your own address was not saved: ${why}`];
|
|
159768
159839
|
}
|
|
159769
159840
|
}
|
|
159841
|
+
var addsAppOnly = (values, targets) => targets.length > 0 && values.get(SETUP_RERUN) === "settings";
|
|
159842
|
+
var addAppOnlyText = (targets, added) => targets.every((target) => added.has(target)) ? '\nYour wallet was set up before, so setup only added the app. To add money, ask the app (for example "add 0.50 USDC to my private balance"); it asks about a backup first when none is saved.\n' : "\nYour wallet was set up before, so setup changed nothing else.\n";
|
|
159770
159843
|
async function offerFundNow(deps, { tor, created }) {
|
|
159771
159844
|
const io = deps.io;
|
|
159772
159845
|
try {
|
|
@@ -159778,10 +159851,33 @@ async function offerFundNow(deps, { tor, created }) {
|
|
|
159778
159851
|
`);
|
|
159779
159852
|
}
|
|
159780
159853
|
}
|
|
159781
|
-
async function offerBackup(deps) {
|
|
159854
|
+
async function offerBackup(deps, home = setupHome(deps.env)) {
|
|
159782
159855
|
const io = deps.io;
|
|
159783
|
-
|
|
159784
|
-
if (
|
|
159856
|
+
if (backupRecord(home)?.cleared) return;
|
|
159857
|
+
if (!canBackUp(home)) {
|
|
159858
|
+
if (!backupNeeded(home)) return;
|
|
159859
|
+
io.out("\nYour wallet's recovery file is not on this computer any more. It is the only way to get your money back if this computer breaks or is lost.\n");
|
|
159860
|
+
let warned2 = false;
|
|
159861
|
+
for (; ; ) {
|
|
159862
|
+
const answer = String(await deps.ask("Do you keep a copy of the recovery file in a safe place (a USB drive or another computer)? [y/n] ")).trim();
|
|
159863
|
+
if (/^y(es)?$/i.test(answer)) {
|
|
159864
|
+
recordKeptCopy(home);
|
|
159865
|
+
io.out("Good: that copy is your backup. Keep it safe.\n\n");
|
|
159866
|
+
return;
|
|
159867
|
+
}
|
|
159868
|
+
if (!/^n(o)?$/i.test(answer)) continue;
|
|
159869
|
+
if (warned2) {
|
|
159870
|
+
try {
|
|
159871
|
+
recordBackupSkip(home);
|
|
159872
|
+
} catch {
|
|
159873
|
+
}
|
|
159874
|
+
io.out("No backup was recorded: if this computer breaks, the money is lost.\n\n");
|
|
159875
|
+
return;
|
|
159876
|
+
}
|
|
159877
|
+
warned2 = true;
|
|
159878
|
+
io.out("Without a copy you can lose your money if this computer breaks. Answer n again to go on without one.\n");
|
|
159879
|
+
}
|
|
159880
|
+
}
|
|
159785
159881
|
io.out("\nBack up your wallet now. Its recovery file is the only way to get your money back if this computer breaks or is lost.\n");
|
|
159786
159882
|
let warned = false;
|
|
159787
159883
|
for (; ; ) {
|
|
@@ -159822,6 +159918,20 @@ ${places.map((place, index) => ` ${index + 1} ${place.label}`).join("\n")}
|
|
|
159822
159918
|
}
|
|
159823
159919
|
}
|
|
159824
159920
|
}
|
|
159921
|
+
async function requireBackupBeforeAddress(deps, io, walletFile, again) {
|
|
159922
|
+
const home = walletFile !== void 0 ? dirname36(dirname36(resolve41(walletFile))) : setupHome(deps.env);
|
|
159923
|
+
let config;
|
|
159924
|
+
try {
|
|
159925
|
+
config = readSetupConfig(home);
|
|
159926
|
+
} catch {
|
|
159927
|
+
config = null;
|
|
159928
|
+
}
|
|
159929
|
+
if (!config?.pool || walletFile !== void 0 && !sameFile(walletFile, homeWalletPath(home, config.pool))) return;
|
|
159930
|
+
if (!backupNeeded(home)) return;
|
|
159931
|
+
if (deps.stdinIsTTY() && deps.stdoutIsTTY?.() === true) await offerBackup({ ...deps, io }, home);
|
|
159932
|
+
if (!backupNeeded(home)) return;
|
|
159933
|
+
throw new PublicFailure(`backup_needed: this wallet has no backup yet, so no deposit address was made; nothing was moved. Run ${again} in a terminal (it asks where to save the backup first), or ask your agent app to "save my backup"`);
|
|
159934
|
+
}
|
|
159825
159935
|
async function askFundNow(deps, { tor, created }) {
|
|
159826
159936
|
const io = deps.io;
|
|
159827
159937
|
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
@@ -160151,7 +160261,7 @@ var RESTART_APP = (app) => `If ${app} is open now, quit it and start it again.`;
|
|
|
160151
160261
|
function hostAddedNext(target, app, platform) {
|
|
160152
160262
|
const ask = 'then ask in plain words, for example "what is my Shinjuku balance".';
|
|
160153
160263
|
if (target === "claude-desktop") {
|
|
160154
|
-
const quit = platform === "win32" ? "If Claude Desktop is open now, quit it: right-click its icon by the clock and choose
|
|
160264
|
+
const quit = platform === "win32" ? "If Claude Desktop is open now, quit it: right-click its icon by the clock (it may be under the ^ arrow there) and choose Exit (closing its window does not quit it). Then open it again" : platform === "darwin" ? "If Claude Desktop is open now, quit it (Claude > Quit Claude, or Command+Q) and open it again" : `${RESTART_APP(app).slice(0, -1)}`;
|
|
160155
160265
|
return `${quit}. In a new chat, click + and choose Connectors to see Shinjuku there, ${ask}`;
|
|
160156
160266
|
}
|
|
160157
160267
|
if (target === "codex") {
|
|
@@ -160508,6 +160618,8 @@ async function runSetupCommand(values, deps) {
|
|
|
160508
160618
|
COMMAND_BY_NAME.get("setup")
|
|
160509
160619
|
);
|
|
160510
160620
|
}
|
|
160621
|
+
const prover = proverPlatform({ platform: deps.platform, arch: deps.arch });
|
|
160622
|
+
if (!prover.ok) throw new PublicFailure(`${prover.detail[0].toUpperCase()}${prover.detail.slice(1)}.`);
|
|
160511
160623
|
const npmVersion = deps.walletVersion().npm;
|
|
160512
160624
|
let ownAddress = values.get("--own-address");
|
|
160513
160625
|
let old;
|
|
@@ -160675,18 +160787,11 @@ async function runSetupCommand(values, deps) {
|
|
|
160675
160787
|
deps,
|
|
160676
160788
|
{ force: values.has("--force"), npmVersion, ask: interactive && deps.stdinIsTTY() ? deps.ask : void 0, noTor: values.has("--no-tor") }
|
|
160677
160789
|
) : void 0;
|
|
160790
|
+
const added2 = /* @__PURE__ */ new Set([...hosts2?.added ?? [], ...hosts2?.kept ?? []]);
|
|
160678
160791
|
if (readsBack) readEmpty();
|
|
160792
|
+
else if (addsAppOnly(values, targets2)) io.out(addAppOnlyText(targets2, new Set(hosts2?.added ?? [])));
|
|
160679
160793
|
else await offerFundNow(deps, { tor: config2?.tor === true, created: !old });
|
|
160680
|
-
io.out(setupNextText({
|
|
160681
|
-
home,
|
|
160682
|
-
deps,
|
|
160683
|
-
npmVersion,
|
|
160684
|
-
config: config2,
|
|
160685
|
-
fundAsked: true,
|
|
160686
|
-
rerun: values.get(SETUP_RERUN) === "settings",
|
|
160687
|
-
targets: targets2,
|
|
160688
|
-
added: /* @__PURE__ */ new Set([...hosts2?.added ?? [], ...hosts2?.kept ?? []])
|
|
160689
|
-
}));
|
|
160794
|
+
io.out(setupNextText({ home, deps, npmVersion, config: config2, fundAsked: true, rerun: values.get(SETUP_RERUN) === "settings", targets: targets2, added: added2 }));
|
|
160690
160795
|
return void 0;
|
|
160691
160796
|
}
|
|
160692
160797
|
let lastStage;
|
|
@@ -160761,6 +160866,7 @@ Copy it to two offline places now; it is the only way to restore this wallet.
|
|
|
160761
160866
|
return void 0;
|
|
160762
160867
|
}
|
|
160763
160868
|
if (readsBack) readEmpty();
|
|
160869
|
+
else if (interactive && addsAppOnly(values, targets)) io.out(addAppOnlyText(targets, new Set(hosts?.added ?? [])));
|
|
160764
160870
|
else if (interactive) await offerFundNow(deps, { tor: config?.tor === true, created: !old });
|
|
160765
160871
|
io.out(setupNextText({ home, deps, npmVersion, config, fundAsked: interactive || readsBack, rerun, targets, added }));
|
|
160766
160872
|
}
|
|
@@ -161057,10 +161163,13 @@ var COMMANDS = [
|
|
|
161057
161163
|
// In a terminal without --json or --verbose: its own progress lines stay off the screen (funds/addFunds.mjs fundsOutput).
|
|
161058
161164
|
quietProgress: (values, deps) => fundsOutput(values, deps).quiet,
|
|
161059
161165
|
run: async (args, values, deps, io) => {
|
|
161060
|
-
|
|
161061
|
-
|
|
161062
|
-
|
|
161166
|
+
let walletFile;
|
|
161167
|
+
try {
|
|
161168
|
+
walletFile = values.has("--pool") ? deps.walletPath(values.get("--pool")) : void 0;
|
|
161169
|
+
} catch {
|
|
161170
|
+
walletFile = void 0;
|
|
161063
161171
|
}
|
|
161172
|
+
await requireBackupBeforeAddress(deps, io, walletFile, `${CLI_WORD} add-funds`);
|
|
161064
161173
|
await fillAddFunds(values, { ...deps, io });
|
|
161065
161174
|
return deps.fundsMain("add-funds", values, { ...deps, io });
|
|
161066
161175
|
}
|
|
@@ -161145,7 +161254,20 @@ var COMMANDS = [
|
|
|
161145
161254
|
},
|
|
161146
161255
|
// A step of add-funds --verbose (STEP_VERBOSE_ENV) shows its progress lines (H18).
|
|
161147
161256
|
quietProgress: (values, deps) => deps.env[STEP_VERBOSE_ENV] !== "1" && progressQuiet(values),
|
|
161148
|
-
|
|
161257
|
+
// Codex round 1 on 6b495a20 item 2: the first run makes the deposit's address, so it waits for the backup; a --submit
|
|
161258
|
+
// run sends a deposit already recorded (money may be at its address) and is never refused.
|
|
161259
|
+
run: async (args, values, deps, io) => {
|
|
161260
|
+
if (!values.has("--submit")) {
|
|
161261
|
+
let walletFile;
|
|
161262
|
+
try {
|
|
161263
|
+
walletFile = commandWalletPath(values, deps);
|
|
161264
|
+
} catch {
|
|
161265
|
+
walletFile = void 0;
|
|
161266
|
+
}
|
|
161267
|
+
await requireBackupBeforeAddress(deps, io, walletFile, `${CLI_WORD} add-funds`);
|
|
161268
|
+
}
|
|
161269
|
+
return runDeposit(args, values, deps);
|
|
161270
|
+
}
|
|
161149
161271
|
},
|
|
161150
161272
|
{
|
|
161151
161273
|
name: "deposit-reclaim",
|
|
@@ -161734,8 +161856,8 @@ var COMMANDS = [
|
|
|
161734
161856
|
// A restored wallet that read back nothing to spend: money first, as restore says (the lead team, 2026-10-29).
|
|
161735
161857
|
nextAfterRun: (values) => values.get(SETUP_READ_EMPTY) === true ? inHomeJob() ? "add money to your private balance: press [a] on the home screen." : `add money to your private balance:
|
|
161736
161858
|
${CLI_WORD} add-funds` : values.get(SETUP_RERUN) === "settings" ? `${inHomeJob() ? "press [t] on the home screen to chat privately with an AI." : `chat privately with an AI in this terminal:
|
|
161737
|
-
${CLI_WORD} chat`}
|
|
161738
|
-
If an agent app already runs the wallet,
|
|
161859
|
+
${CLI_WORD} chat`}` + (values.has("--add-to") ? "" : `
|
|
161860
|
+
If an agent app already runs the wallet, quit it and start it again so it reads these settings${process.platform === "win32" ? " (Claude Desktop: right-click its icon by the clock and choose Exit; closing its window does not quit it)" : ""}.`) : 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,
|
|
161739
161861
|
// Its progress lines (tor:, rpc:, history:) never show, in a terminal or not (progressQuiet; setup has no --verbose);
|
|
161740
161862
|
// Tor trouble shows in plain words (inference/chat.mjs hideProgressLines). Live run 2026-10-24 08:26 UTC (npm 0.3.97, laptop, Tor on): setup printed
|
|
161741
161863
|
// the raw onion line "tor: the onion ... gave no answer (the stream failed); its requests move to ...". The Tor run's
|
|
@@ -163609,6 +163731,7 @@ async function runPayMe(values, deps, io) {
|
|
|
163609
163731
|
`);
|
|
163610
163732
|
return;
|
|
163611
163733
|
}
|
|
163734
|
+
await requireBackupBeforeAddress(deps, io, resolve41(values.get("--wallet")), `${CLI_WORD} add-funds`);
|
|
163612
163735
|
const record = await createPayMe({ store, connection, id, amountAtomic: values.get("--amount"), note: values.get("--note") });
|
|
163613
163736
|
io.out(`${JSON.stringify({
|
|
163614
163737
|
ok: true,
|