shinjuku-shield 0.3.240 → 0.3.241
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 +3 -3
- package/manifest.json +4 -4
- package/package.json +3 -3
- package/shinjuku-wallet.mjs +126 -25
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.
|
|
11
|
+
This is version 0.3.241. 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.
|
|
115
|
+
claude mcp add --scope user shinjuku -- npx -y --prefer-offline --no-audit --no-fund shinjuku-shield@0.3.241 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.
|
|
134
|
+
0.3.241, 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": "
|
|
5
|
-
"bytes":
|
|
6
|
-
"sourceCommit": "
|
|
4
|
+
"sha256": "c2684fe19752934e1929cfda02af086706f98bcea3b3281b787e74e3e55f6d2d",
|
|
5
|
+
"bytes": 10590249,
|
|
6
|
+
"sourceCommit": "ca50f3c28b2fbc8e66c32d47fcecd5ad102d4ac8",
|
|
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",
|
|
@@ -2080,5 +2080,5 @@
|
|
|
2080
2080
|
}
|
|
2081
2081
|
]
|
|
2082
2082
|
},
|
|
2083
|
-
"publishedAt": "2026-11-
|
|
2083
|
+
"publishedAt": "2026-11-17T18:57:15.643Z"
|
|
2084
2084
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinjuku-shield",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.241",
|
|
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": "
|
|
7
|
-
"shinjukuSha256": "
|
|
6
|
+
"shinjukuRelease": "c2684fe1",
|
|
7
|
+
"shinjukuSha256": "c2684fe19752934e1929cfda02af086706f98bcea3b3281b787e74e3e55f6d2d",
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
9
9
|
"author": "Shinjuku Shield",
|
|
10
10
|
"homepage": "https://github.com/ShinjukuStaition/shinjuku-shield#readme",
|
package/shinjuku-wallet.mjs
CHANGED
|
@@ -163053,7 +163053,7 @@ var init_homeMark = __esm({
|
|
|
163053
163053
|
function homeKeys(data) {
|
|
163054
163054
|
const tor = data?.torToggle === true && (data.tor === true || data.tor === false) ? [["o", data.tor ? "turn tor off" : "turn tor on"]] : [];
|
|
163055
163055
|
const setup = walletNotices(data ?? {}).some((notice) => notice.command) ? [["s", "finish setup"]] : [];
|
|
163056
|
-
const shield = setup.length ? [] : data?.shieldOpen ? [["m", "finish making USDC private"]] :
|
|
163056
|
+
const shield = setup.length || data?.setUp !== true ? [] : data?.shieldOpen ? [["m", "finish making USDC private"]] : [["m", "make public USDC private"]];
|
|
163057
163057
|
return [
|
|
163058
163058
|
...setup,
|
|
163059
163059
|
...shield,
|
|
@@ -163845,12 +163845,15 @@ ${rule}
|
|
|
163845
163845
|
|
|
163846
163846
|
`);
|
|
163847
163847
|
let code2;
|
|
163848
|
+
let endWords;
|
|
163848
163849
|
try {
|
|
163849
|
-
|
|
163850
|
+
const result = await run2();
|
|
163851
|
+
if (result !== null && typeof result === "object") ({ code: code2, ended: endWords } = result);
|
|
163852
|
+
else code2 = result;
|
|
163850
163853
|
} catch {
|
|
163851
163854
|
code2 = 1;
|
|
163852
163855
|
}
|
|
163853
|
-
const end2 = code2 === 0 ? [["\u25C6 ", "crim"], [`${clean4(title)}: done`, "bone"]] : code2 === 130 ? [["\u25C6 ", "crim"], [`${clean4(title)}: stopped (Ctrl+C)`, "bone"]] : [["\u25CB ", "mute"], [`${clean4(title)}: it stopped; its message is above`, "bone"]];
|
|
163856
|
+
const end2 = code2 === 0 ? [["\u25C6 ", "crim"], [`${clean4(title)}: ${endWords ? clean4(endWords) : "done"}`, "bone"]] : code2 === 130 ? [["\u25C6 ", "crim"], [`${clean4(title)}: stopped (Ctrl+C)`, "bone"]] : [["\u25CB ", "mute"], [`${clean4(title)}: it stopped; its message is above`, "bone"]];
|
|
163854
163857
|
const gone = () => {
|
|
163855
163858
|
try {
|
|
163856
163859
|
return launcherGone();
|
|
@@ -174790,6 +174793,12 @@ async function walletHolderRole(walletFile) {
|
|
|
174790
174793
|
return void 0;
|
|
174791
174794
|
}
|
|
174792
174795
|
}
|
|
174796
|
+
var HomeJobFailure = class extends PublicFailure {
|
|
174797
|
+
constructor(code2, plain) {
|
|
174798
|
+
super(`${code2}: ${plain}`);
|
|
174799
|
+
this.plain = plain;
|
|
174800
|
+
}
|
|
174801
|
+
};
|
|
174793
174802
|
var AnswerDeclined = class extends PublicFailure {
|
|
174794
174803
|
constructor(code2, plain) {
|
|
174795
174804
|
super(`${code2}: ${plain}`);
|
|
@@ -176689,6 +176698,67 @@ async function runInferStart(values, deps) {
|
|
|
176689
176698
|
""
|
|
176690
176699
|
].join("\n"));
|
|
176691
176700
|
}
|
|
176701
|
+
async function homeStartLocalAi(walletFile, status, walletMaxPaymentAtomic, deps) {
|
|
176702
|
+
const io = deps.io;
|
|
176703
|
+
const appWords = 'If you use an AI app, you can also ask it: "Give my other AI app a private AI address."';
|
|
176704
|
+
if (!(deps.stdinIsTTY() && deps.stdoutIsTTY?.() === true)) {
|
|
176705
|
+
io.out(`No private AI address is running now. ${appWords} Then press i again to see its key.
|
|
176706
|
+
`);
|
|
176707
|
+
return void 0;
|
|
176708
|
+
}
|
|
176709
|
+
const torChosen = deps.env[HOME_TOR_CHOICE_ENV] === "1";
|
|
176710
|
+
io.out([
|
|
176711
|
+
"No private AI address is running now.",
|
|
176712
|
+
"It lets another app on this computer use the private AI: each answer is paid from your private balance, through Tor.",
|
|
176713
|
+
...torChosen ? [] : ["This wallet runs without Tor now. A private AI address runs only through Tor (so the AI provider does not see your IP address): starting it starts Tor for the private AI address alone; the rest of the wallet stays without Tor."],
|
|
176714
|
+
`Caps when it starts: ${localAiCapsText(status.caps, status.limits)}.`
|
|
176715
|
+
].join("\n") + "\n");
|
|
176716
|
+
if (!await typedYes("Start a private AI address on this computer now, through Tor? [y/N] ", deps, io)) {
|
|
176717
|
+
io.out(`Nothing was started. ${appWords}
|
|
176718
|
+
`);
|
|
176719
|
+
return void 0;
|
|
176720
|
+
}
|
|
176721
|
+
io.out("Starting your private AI address: it connects through Tor and opens your wallet first...\n");
|
|
176722
|
+
const env = { ...deps.env };
|
|
176723
|
+
delete env[NO_TOR_RUN_ENV];
|
|
176724
|
+
delete env[HOME_TOR_CHOICE_ENV];
|
|
176725
|
+
const answer = await (deps.startLocalAiServer ?? startLocalAiServer)({
|
|
176726
|
+
walletPath: walletFile,
|
|
176727
|
+
env,
|
|
176728
|
+
npmVersion: deps.walletVersion().npm,
|
|
176729
|
+
...walletMaxPaymentAtomic !== void 0 ? { walletMaxPaymentAtomic } : {}
|
|
176730
|
+
});
|
|
176731
|
+
if (answer.state === "failed") {
|
|
176732
|
+
throw new HomeJobFailure("inference_server_not_started", `Your private AI address did not start: ${answer.detail}. Nothing was paid. Press i to try again.`);
|
|
176733
|
+
}
|
|
176734
|
+
return (deps.localAiServerStatus ?? localAiServerStatus)({ walletPath: walletFile, ...walletMaxPaymentAtomic !== void 0 ? { walletMaxPaymentAtomic } : {} });
|
|
176735
|
+
}
|
|
176736
|
+
async function homeStopLocalAi(walletFile, deps) {
|
|
176737
|
+
const io = deps.io;
|
|
176738
|
+
if (!(deps.stdinIsTTY() && deps.stdoutIsTTY?.() === true)) return;
|
|
176739
|
+
let yes2;
|
|
176740
|
+
try {
|
|
176741
|
+
yes2 = await typedYes("Stop the private AI address now? [y/N] ", deps, io);
|
|
176742
|
+
} catch (error) {
|
|
176743
|
+
if (!(error instanceof QuestionCancelled)) throw error;
|
|
176744
|
+
throw new HomeJobFailure("inference_server_stop_cancelled", "The stop was cancelled: your private AI address still runs. Press i to stop it.");
|
|
176745
|
+
}
|
|
176746
|
+
if (!yes2) return;
|
|
176747
|
+
const result = await (deps.stopLocalAiServer ?? stopLocalAiServer)({ walletPath: walletFile });
|
|
176748
|
+
if (!result.stopped) {
|
|
176749
|
+
if (result.running === false) {
|
|
176750
|
+
io.out("Your private AI address had already stopped. Press i to start it again.\n");
|
|
176751
|
+
return;
|
|
176752
|
+
}
|
|
176753
|
+
throw new HomeJobFailure("inference_server_stop_failed", `Your private AI address did not stop: ${result.detail}. It still runs. Press i to try again.`);
|
|
176754
|
+
}
|
|
176755
|
+
io.out([
|
|
176756
|
+
`Your private AI address stopped${result.forced ? `: ${result.detail}` : ""}.`,
|
|
176757
|
+
...result.spentAtomic !== void 0 ? [`It paid ${usdcOr(result.spentAtomic)} for ${requestsWords(result.requests)}.`] : [],
|
|
176758
|
+
"Your agent app keeps base_url and the api key; press i to start it again with the same key.",
|
|
176759
|
+
""
|
|
176760
|
+
].join("\n"));
|
|
176761
|
+
}
|
|
176692
176762
|
async function runInferStatus(values, deps) {
|
|
176693
176763
|
const io = deps.io;
|
|
176694
176764
|
const walletFile = localAiWalletOf(values);
|
|
@@ -176701,7 +176771,7 @@ async function runInferStatus(values, deps) {
|
|
|
176701
176771
|
}
|
|
176702
176772
|
const walletMaxPaymentAtomic = walletState?.config?.maxPaymentAtomic;
|
|
176703
176773
|
const walletShort = walletState ? walletShortAddress(walletState) : void 0;
|
|
176704
|
-
|
|
176774
|
+
let status = await (deps.localAiServerStatus ?? localAiServerStatus)({
|
|
176705
176775
|
walletPath: walletFile,
|
|
176706
176776
|
...walletMaxPaymentAtomic !== void 0 ? { walletMaxPaymentAtomic } : {}
|
|
176707
176777
|
});
|
|
@@ -176712,11 +176782,18 @@ async function runInferStatus(values, deps) {
|
|
|
176712
176782
|
}
|
|
176713
176783
|
const verbose = values.has("--verbose");
|
|
176714
176784
|
const lines = [];
|
|
176715
|
-
if (inHomeJob(deps.env) && status.state !== "listening") {
|
|
176716
|
-
io.out(status.state === "starting" ? "Your private AI address is starting: it connects through Tor and opens your wallet first. Press i again in a few seconds to see its key.\n" : 'No private AI address is running now. To start one, ask your AI app: "Give my other AI app a private AI address." Then press i again to see its key.\n');
|
|
176717
|
-
return;
|
|
176718
|
-
}
|
|
176719
176785
|
if (inHomeJob(deps.env)) {
|
|
176786
|
+
if (status.state === "stopped") {
|
|
176787
|
+
status = await homeStartLocalAi(walletFile, status, walletMaxPaymentAtomic, deps);
|
|
176788
|
+
if (!status) return;
|
|
176789
|
+
if (status.state === "stopped") {
|
|
176790
|
+
throw new HomeJobFailure("inference_server_not_started", `Your private AI address stopped right after its start${status.last?.state === "failed" && status.last.detail ? `: ${status.last.detail}` : ""}. Nothing was paid. Press i to try again.`);
|
|
176791
|
+
}
|
|
176792
|
+
}
|
|
176793
|
+
if (status.state === "starting") {
|
|
176794
|
+
io.out("Your private AI address is starting: it connects through Tor and opens your wallet first. Press i again in a few seconds to see its key.\n");
|
|
176795
|
+
return;
|
|
176796
|
+
}
|
|
176720
176797
|
if (!walletShort) {
|
|
176721
176798
|
io.out("This screen could not read which wallet it opened, so it shows no key. Ask your AI app again for the private AI address; it names the steps.\n");
|
|
176722
176799
|
return;
|
|
@@ -176727,9 +176804,11 @@ async function runInferStatus(values, deps) {
|
|
|
176727
176804
|
...localAiPasteLines(status),
|
|
176728
176805
|
`Caps: ${localAiCapsText(status.caps, status.limits)}. Paid so far: ${usdcOr(status.spentAtomic ?? "0")} for ${requestsWords(status.requests)}.`,
|
|
176729
176806
|
...await localAiFloorRaiseLines(status.caps, deps),
|
|
176730
|
-
"It stops when the computer restarts; then
|
|
176807
|
+
"It stops when the computer restarts; then press i to start it again (the api key stays the same).",
|
|
176808
|
+
"If you use an AI app, you can also ask it to stop the private AI address."
|
|
176731
176809
|
].join("\n")}
|
|
176732
176810
|
`);
|
|
176811
|
+
await homeStopLocalAi(walletFile, deps);
|
|
176733
176812
|
return;
|
|
176734
176813
|
}
|
|
176735
176814
|
if (walletShort) lines.push(`Wallet ${walletShort}.`);
|
|
@@ -177127,6 +177206,7 @@ function offlineTorRefusal(argv2) {
|
|
|
177127
177206
|
return `${name} reads only files on this computer and never goes online, so it takes no --tor or --proxy. Nothing was sent. Run it again without ${argv2.includes("--tor") ? "--tor" : "--proxy"}`;
|
|
177128
177207
|
}
|
|
177129
177208
|
var NO_TOR_RUN_ENV = "SHINJUKU_WALLET_NO_TOR";
|
|
177209
|
+
var HOME_TOR_CHOICE_ENV = "SHINJUKU_WALLET_HOME_TOR";
|
|
177130
177210
|
function homeJobTor(argv2, env) {
|
|
177131
177211
|
if (runNetworkMode() !== null) return true;
|
|
177132
177212
|
let job;
|
|
@@ -179321,12 +179401,9 @@ async function runSetupCommandHeld(values, deps) {
|
|
|
179321
179401
|
// S2 (a live check on the published 0.3.99): the help's words (shortHelpText), not "x402 URLs".
|
|
179322
179402
|
"Shinjuku Shield: your private wallet on this computer. It pays for AI answers and paid web services from your private balance.",
|
|
179323
179403
|
readsBack ? "Setup keeps the restored wallet on this machine (your keys never leave it), downloads and checks the setup files, and writes config.json." : repairRun ? "Setup keeps your wallet on this machine as it is (your keys never leave it), downloads and checks the setup files, and writes config.json again." : "Setup makes the wallet on this machine (your keys never leave it), downloads and checks the setup files, and writes config.json.",
|
|
179324
|
-
// 0.3.
|
|
179325
|
-
|
|
179326
|
-
//
|
|
179327
|
-
// --prefix (npm reads no .npmrc of the folder the app starts in); a Windows home with a cmd sign, $ or ` gets none, as
|
|
179328
|
-
// the entry. Quoted for the user's shell (hostShellWord: single quotes on POSIX; Codex round 1 on 1b3aaa99 item 2).
|
|
179329
|
-
` ${oneTimeCommandLine("mcp", npmVersion, { appLine: true, npmArgs: npmPrefixArgs(home, deps.platform ?? process.platform).map((word2) => hostShellWord(word2, deps.platform ?? process.platform)) })}`,
|
|
179404
|
+
// The agent app's start line is not shown here (a terminal run on npm 0.3.240: an internal line to a person who never
|
|
179405
|
+
// pastes it): setup writes it into each app it adds, and home [c] "another app" shows it with the app entry's
|
|
179406
|
+
// --prefix (row 25 rerun on 0.3.174, check C) where a person must paste it.
|
|
179330
179407
|
""
|
|
179331
179408
|
],
|
|
179332
179409
|
// The status line too, when a terminal setup started this run and printed it (AB234's live run 2026-11-04 showed
|
|
@@ -182962,15 +183039,18 @@ var SHIELD_STAGE_WORDS = {
|
|
|
182962
183039
|
sending: "Sending the deposit..."
|
|
182963
183040
|
};
|
|
182964
183041
|
async function confirmShield(question, deps, io, declined) {
|
|
183042
|
+
if (!await typedYes(question, deps, io)) throw new AnswerDeclined("shield_declined", declined);
|
|
183043
|
+
}
|
|
183044
|
+
async function typedYes(question, deps, io) {
|
|
182965
183045
|
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
182966
183046
|
const reply = await deps.ask(question, { typedOnly: true });
|
|
182967
183047
|
const { answer, typed } = reply !== null && typeof reply === "object" ? reply : { answer: reply, typed: false };
|
|
182968
183048
|
const yes2 = /^y(es)?$/i.test(String(answer ?? "").trim());
|
|
182969
|
-
if (yes2 && typed === true) return;
|
|
182970
|
-
if (!yes2)
|
|
183049
|
+
if (yes2 && typed === true) return true;
|
|
183050
|
+
if (!yes2) return false;
|
|
182971
183051
|
io.err("That y came in pasted text, or too fast after it, so it does not count. Type y yourself and press Enter, or press Enter to stop.\n");
|
|
182972
183052
|
}
|
|
182973
|
-
|
|
183053
|
+
return false;
|
|
182974
183054
|
}
|
|
182975
183055
|
async function runShieldCommand(values, deps, io) {
|
|
182976
183056
|
const terminal = deps.stdinIsTTY() && deps.stdoutIsTTY?.() === true;
|
|
@@ -183027,6 +183107,11 @@ async function runShieldCommand(values, deps, io) {
|
|
|
183027
183107
|
} catch {
|
|
183028
183108
|
}
|
|
183029
183109
|
if (BigInt(held2) < SHIELD_MIN_ATOMIC2) {
|
|
183110
|
+
if (home) {
|
|
183111
|
+
io.out(BigInt(held2) === 0n ? "Your own address holds 0 USDC, so nothing waits there to be made private. Nothing was moved.\n" : `Your own address holds ${usdcOr(held2)}; the least that can be made private is ${usdcOr(SHIELD_MIN_ATOMIC2)}. Nothing was moved.
|
|
183112
|
+
`);
|
|
183113
|
+
return;
|
|
183114
|
+
}
|
|
183030
183115
|
throw new PublicFailure(`nothing_to_shield: your own address holds ${usdcOr(held2)}, and the least that can be made private is ${usdcOr(SHIELD_MIN_ATOMIC2)}. Nothing was moved`);
|
|
183031
183116
|
}
|
|
183032
183117
|
if (typedAmount !== void 0) {
|
|
@@ -184548,7 +184633,7 @@ ${places.map((place, index) => ` ${index + 1} ${place.label}`).join("\n")}
|
|
|
184548
184633
|
const answer = String(await deps.ask("Type a number or a folder, or press Enter to stop (plug in a USB drive first to see it): ")).trim();
|
|
184549
184634
|
if (!answer) {
|
|
184550
184635
|
io.err("No backup was saved.\n");
|
|
184551
|
-
return 0;
|
|
184636
|
+
return { code: 0, ended: "no backup was saved" };
|
|
184552
184637
|
}
|
|
184553
184638
|
const chosen = /^\d+$/.test(answer) ? places[Number(answer) - 1] : { path: answer, removable: void 0 };
|
|
184554
184639
|
if (!chosen) {
|
|
@@ -184651,7 +184736,7 @@ async function homeKeyJob(key, { data, argv: argv2, deps }) {
|
|
|
184651
184736
|
if (key === "a") return await child(["add-funds"]);
|
|
184652
184737
|
if (key === "u") return await child(["unshield"]);
|
|
184653
184738
|
if (key === "l") return await deps.runHomeChild(["limits"], { ...deps.env, [NO_TOR_RUN_ENV]: "1" });
|
|
184654
|
-
if (key === "i") return await deps.runHomeChild(["infer", "status"], { ...deps.env, [NO_TOR_RUN_ENV]: "1" });
|
|
184739
|
+
if (key === "i") return await deps.runHomeChild(["infer", "status"], { ...deps.env, [NO_TOR_RUN_ENV]: "1", [HOME_TOR_CHOICE_ENV]: data?.tor === true ? "1" : "0" });
|
|
184655
184740
|
if (key === "o") return await deps.homeTorToggle(data, deps);
|
|
184656
184741
|
if (key === "b") return await deps.homeBackup(data, deps);
|
|
184657
184742
|
if (key === "r") {
|
|
@@ -184659,27 +184744,43 @@ async function homeKeyJob(key, { data, argv: argv2, deps }) {
|
|
|
184659
184744
|
return file ? await child(["restore", "--recovery", file]) : 0;
|
|
184660
184745
|
}
|
|
184661
184746
|
if (key === "p") {
|
|
184662
|
-
|
|
184747
|
+
io.err("Paste the full link of a paid web service, such as https://example.com/api/report (you see its price before anything is paid).\n");
|
|
184748
|
+
const link3 = String(await deps.ask("Link to pay (Enter alone = back): ")).trim();
|
|
184663
184749
|
if (!link3) {
|
|
184664
184750
|
io.err("No link given, so nothing was paid.\n");
|
|
184665
|
-
return 0;
|
|
184751
|
+
return { code: 0, ended: "nothing was paid" };
|
|
184666
184752
|
}
|
|
184667
184753
|
return await child(["curl", "--url", link3]);
|
|
184668
184754
|
}
|
|
184669
184755
|
if (key !== "c") return 0;
|
|
184670
184756
|
const hostNames = HOST_NAMES;
|
|
184757
|
+
const other = HOST_TARGETS.length + 1;
|
|
184671
184758
|
io.err(`Which agent app gets the wallet?
|
|
184672
184759
|
${HOST_TARGETS.map((host, index) => ` ${index + 1} ${hostNames[host] ?? host}`).join("\n")}
|
|
184760
|
+
${other} another app (not in this list)
|
|
184673
184761
|
`);
|
|
184674
184762
|
for (; ; ) {
|
|
184675
|
-
const answer = String(await deps.ask(`Type its number (1 to ${
|
|
184763
|
+
const answer = String(await deps.ask(`Type its number (1 to ${other}), or press Enter to stop: `)).trim();
|
|
184676
184764
|
if (!answer) {
|
|
184677
184765
|
io.err("No agent app chosen, so nothing was changed.\n");
|
|
184766
|
+
return { code: 0, ended: "nothing was changed" };
|
|
184767
|
+
}
|
|
184768
|
+
if (answer === String(other)) {
|
|
184769
|
+
const platform = deps.platform ?? process.platform;
|
|
184770
|
+
io.out([
|
|
184771
|
+
`In your app's settings, add a new tool server (an app may call it an MCP server, type "command" or "stdio") that runs this command:`,
|
|
184772
|
+
` ${oneTimeCommandLine("mcp", deps.walletVersion().npm, {
|
|
184773
|
+
appLine: true,
|
|
184774
|
+
npmArgs: npmPrefixArgs(setupHome(deps.env), platform).map((word2) => hostShellWord(word2, platform))
|
|
184775
|
+
})}`,
|
|
184776
|
+
'Then restart the app and ask it "what is my balance".',
|
|
184777
|
+
""
|
|
184778
|
+
].join("\n"));
|
|
184678
184779
|
return 0;
|
|
184679
184780
|
}
|
|
184680
184781
|
const host = /^[0-9]+$/.test(answer) ? HOST_TARGETS[Number(answer) - 1] : void 0;
|
|
184681
184782
|
if (!host) {
|
|
184682
|
-
io.err(`Type a number from 1 to ${
|
|
184783
|
+
io.err(`Type a number from 1 to ${other}.
|
|
184683
184784
|
`);
|
|
184684
184785
|
continue;
|
|
184685
184786
|
}
|
|
@@ -185083,7 +185184,7 @@ ${step}; or ask with a lower --max-tokens or another --model, which costs less.
|
|
|
185083
185184
|
`);
|
|
185084
185185
|
return 1;
|
|
185085
185186
|
}
|
|
185086
|
-
if (error instanceof WalletInUse || error instanceof SellerRefusal) {
|
|
185187
|
+
if (error instanceof WalletInUse || error instanceof SellerRefusal || error instanceof HomeJobFailure) {
|
|
185087
185188
|
io.err(`${error.plain}
|
|
185088
185189
|
`);
|
|
185089
185190
|
return 1;
|