shinjuku-shielded 0.3.176 → 0.3.178
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 +5 -5
- package/manifest.json +4 -4
- package/package.json +3 -3
- package/shinjuku-wallet.mjs +121 -48
package/README.md
CHANGED
|
@@ -6,13 +6,13 @@ answers privately, in a terminal chat or for your agent app. Its `mcp`
|
|
|
6
6
|
command runs a local MCP server (stdio) for your agent. Your keys never
|
|
7
7
|
leave your machine.
|
|
8
8
|
|
|
9
|
-
This is version 0.3.
|
|
9
|
+
This is version 0.3.178. The npm packages `shinjuku-shield` and
|
|
10
10
|
`shinjuku-shielded` hold the same files. The command is `shinjuku`.
|
|
11
11
|
|
|
12
12
|
## Set up
|
|
13
13
|
|
|
14
14
|
```sh
|
|
15
|
-
npx -y shinjuku@0.3.
|
|
15
|
+
npx -y shinjuku@0.3.178 setup
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
Setup offers to install the `shinjuku` command and, on Windows, adds npm's
|
|
@@ -35,13 +35,13 @@ Every wallet command works after `shinjuku`, for example `shinjuku balance`,
|
|
|
35
35
|
Claude Code:
|
|
36
36
|
|
|
37
37
|
```sh
|
|
38
|
-
claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.
|
|
38
|
+
claude mcp add --scope user shinjuku -- npx -y --no-audit --no-fund shinjuku-shield@0.3.178 mcp
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
Claude Desktop (`claude_desktop_config.json`) or Cursor (`~/.cursor/mcp.json`):
|
|
42
42
|
|
|
43
43
|
```json
|
|
44
|
-
{ "mcpServers": { "shinjuku": { "command": "npx", "args": ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.
|
|
44
|
+
{ "mcpServers": { "shinjuku": { "command": "npx", "args": ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.178", "mcp"] } } }
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
On native Windows, if the host cannot find `npx`, use `"command": "cmd"` and
|
|
@@ -54,7 +54,7 @@ Codex (the Codex app and Codex CLI read the same file, `~/.codex/config.toml`):
|
|
|
54
54
|
```toml
|
|
55
55
|
[mcp_servers.shinjuku]
|
|
56
56
|
command = "npx"
|
|
57
|
-
args = ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.
|
|
57
|
+
args = ["-y", "--no-audit", "--no-fund", "shinjuku-shield@0.3.178", "mcp"]
|
|
58
58
|
startup_timeout_sec = 120
|
|
59
59
|
tool_timeout_sec = 300
|
|
60
60
|
```
|
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": "ab594bac31fc1416d01a6b552a820a8b35f99418b00d66bffd63991692a3f5c6",
|
|
5
|
+
"bytes": 9406427,
|
|
6
|
+
"sourceCommit": "7f0ed64412e94ac55a02cd50638480718c73f72b",
|
|
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-06T01:20:35.699Z"
|
|
1042
1042
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinjuku-shielded",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.178",
|
|
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": "ab594bac",
|
|
7
|
+
"shinjukuSha256": "ab594bac31fc1416d01a6b552a820a8b35f99418b00d66bffd63991692a3f5c6",
|
|
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
|
@@ -144975,7 +144975,7 @@ function moneyOptions({
|
|
|
144975
144975
|
} catch {
|
|
144976
144976
|
canonical5 = false;
|
|
144977
144977
|
}
|
|
144978
|
-
if (!canonical5) throw new Error("mcp_unshield_to_invalid: every send address approved at start must be a base58 Solana address (the value given is not repeated here); the
|
|
144978
|
+
if (!canonical5) throw new Error("mcp_unshield_to_invalid: every send address approved at start must be a base58 Solana address (the value given is not repeated here); the wallet did not start for your AI app and nothing was moved");
|
|
144979
144979
|
}
|
|
144980
144980
|
const unshieldCap = asText(maxUnshieldAtomic);
|
|
144981
144981
|
if (unshieldCap && !POSITIVE_ATOMIC7.test(unshieldCap)) setupInvalid("the unshield limit must be a positive whole number of atomic units");
|
|
@@ -145158,7 +145158,7 @@ async function openWalletServer({
|
|
|
145158
145158
|
if (!POSITIVE_ATOMIC7.test(asText(maxPaymentAtomic))) capRequired("the limit per payment (the most one payment may cost; maxPaymentAtomic, in atomic units) is required and must be a positive whole number");
|
|
145159
145159
|
if (!POSITIVE_ATOMIC7.test(asText(maxSessionAtomic))) capRequired("the limit in total (the most this MCP process may pay in total; maxSessionAtomic, in atomic units) is required and must be a positive whole number");
|
|
145160
145160
|
if (BigInt(asText(maxSessionAtomic)) < BigInt(asText(maxPaymentAtomic))) {
|
|
145161
|
-
throw new Error(`mcp_cap_invalid: the limit in total must be at least the limit per payment (${usdcFlagText(asText(maxSessionAtomic))} USDC in total is below ${usdcFlagText(asText(maxPaymentAtomic))} USDC per payment); the
|
|
145161
|
+
throw new Error(`mcp_cap_invalid: the limit in total must be at least the limit per payment (${usdcFlagText(asText(maxSessionAtomic))} USDC in total is below ${usdcFlagText(asText(maxPaymentAtomic))} USDC per payment); the wallet did not start for your AI app and nothing was paid. For example: ${oneTimeCommandLine("mcp --max-payment 0.05 --max-session 0.2")}`);
|
|
145162
145162
|
}
|
|
145163
145163
|
const readyText = asText(readyPockets);
|
|
145164
145164
|
if (readyText && !/^[0-5]$/.test(readyText)) setupInvalid("the number of ready pockets must be a whole number from 0 to 5");
|
|
@@ -145822,10 +145822,10 @@ var init_stdioServer = __esm({
|
|
|
145822
145822
|
LAUNCH_NOTICE_TOOLS = Object.freeze(["wallet_balance", "wallet_status"]);
|
|
145823
145823
|
withLaunchLine = (instructions2, line) => !line ? instructions2 : () => `${typeof instructions2 === "function" ? instructions2() : instructions2} Tell the user: ${line}`;
|
|
145824
145824
|
capRequired = (detail) => {
|
|
145825
|
-
throw new Error(`mcp_cap_required: ${detail}; the
|
|
145825
|
+
throw new Error(`mcp_cap_required: ${detail}; the wallet did not start for your AI app. Start it with both limits, for example (0.05 USDC per payment, 0.20 USDC in total): ${oneTimeCommandLine("mcp --max-payment 0.05 --max-session 0.2")}`);
|
|
145826
145826
|
};
|
|
145827
145827
|
setupInvalid = (detail) => {
|
|
145828
|
-
throw new Error(`mcp_setup_invalid: ${detail}; the
|
|
145828
|
+
throw new Error(`mcp_setup_invalid: ${detail}; the wallet did not start for your AI app and nothing was moved`);
|
|
145829
145829
|
};
|
|
145830
145830
|
TOOL_ROOTS_WAIT_MS = 6e4;
|
|
145831
145831
|
ROOTS_FREE_TOOLS = /* @__PURE__ */ new Set(["pay_for_service", "inference_chat", "inference_models", "inference_server", "check_price", "find_paid_services"]);
|
|
@@ -158023,41 +158023,103 @@ var PROGRESS = /^(downloading the setup files|tor: |history: )/;
|
|
|
158023
158023
|
var LABEL = /^ {2}([a-z][a-z -]{1,12}?)( {2,}|(?<=^ {2}.{12}) )(\S.*)$/;
|
|
158024
158024
|
var COMMAND = /^ {2}(npx |shinjuku |claude |codex |cursor |\$ )/;
|
|
158025
158025
|
var NEXT = /^(Next|Status|Home|Then): ?(.*)$/;
|
|
158026
|
-
var
|
|
158027
|
-
var
|
|
158028
|
-
|
|
158029
|
-
|
|
158030
|
-
|
|
158031
|
-
|
|
158032
|
-
|
|
158033
|
-
|
|
158034
|
-
|
|
158035
|
-
|
|
158026
|
+
var NPM_COMMAND = String.raw`npm(?= (?:install|i|uninstall|ci|cache|config|prefix|root|bin|exec|run|view|ls|update|set|get|-\S*)(?:\s|$))`;
|
|
158027
|
+
var SHINJUKU_COMMAND = String.raw`shinjuku(?= (?:add-funds|backup-export|backup-verify|balance|buy-item|cancel|chat|curl|deposit[a-z-]*|funds-status|help|infer|init|keep-warm|limits|mcp|move|own-address|pay|pay-me|prepare|recover|restore|seller[a-z-]*|setup[a-z-]*|transfer-token|unshield[a-z-]*|version)(?:\s|$))`;
|
|
158028
|
+
var COMMAND_PROGRAM = String.raw`(?:npx|${NPM_COMMAND}|iwr|${SHINJUKU_COMMAND}|hermes|claude|codex|cursor|chmod|chown|wsl|Stop-Process|powershell|cmd|tor)`;
|
|
158029
|
+
var WHOLE_LINE_SIGNS = new RegExp(String.raw`^\s*(?:${COMMAND_PROGRAM}(?= |$)|[&$]|["{}\[\]]|- |[A-Za-z_][\w.-]*[ \t]*=)|^\s+[A-Za-z_][\w.-]*:(?: |$)`);
|
|
158030
|
+
var CODE_TOKEN2 = /^(?:-|[^\s,;()]*[=@\\/:])/;
|
|
158031
|
+
var CONFIG_LINE = /^\s*(?:["{}\[\]]|- |[A-Za-z_][\w.-]*[ \t]*=)|^\s+[A-Za-z_][\w.-]*:(?: |$)/;
|
|
158032
|
+
var COLUMN_ROW = /^([ \t]+)(\S+(?: \S+)*?)( {2,})(\S.*)$/;
|
|
158033
|
+
var ROW_GAP = 3;
|
|
158034
|
+
var PATH_START = /(?:^|\s)(?:[A-Za-z]:\\|\\\\|~\/|\/)/;
|
|
158035
|
+
var CODE_WORDS = /(?:^|\s)-|[\\\/=@`"]/;
|
|
158036
|
+
var UNIT_PATTERNS = [
|
|
158037
|
+
// A command program and up to six words after it, to the next , ; ( ); while its words hold code (a flag, a path, =, @
|
|
158038
|
+
// or :), it goes on to the next such sign or the end (Claude Code's "with command: cmd /c npx ... mcp to user config").
|
|
158039
|
+
new RegExp(String.raw`\b${COMMAND_PROGRAM}(?: [^\s,;()]+){1,6}`, "g"),
|
|
158040
|
+
// A path: a drive, \\, ~/ or / and its next words that go on with a separator ("C:\Users\John Smith\.shinjuku-shield").
|
|
158041
|
+
/(?:\b[A-Za-z]:\\|\\\\|~\/|(?<![\w.])\/)[^\s,;()"]*(?: [^\s,;()"]*[\\/][^\s,;()"]*)*/g,
|
|
158042
|
+
// A URL; a backtick span; a flag with its value ("--max-payment 0.05", "--add-to claude-code").
|
|
158043
|
+
/\b[a-z]+:\/\/[^\s,;()"]+/g,
|
|
158044
|
+
/`[^`\n]*`/g,
|
|
158045
|
+
/(?<!\S)--?[A-Za-z][\w-]*(?:[ =](?!-)[^\s,;()]+)?/g,
|
|
158046
|
+
// A quoted example request or a JSON entry ("tor": false, "inference": { "enabled": false }).
|
|
158047
|
+
/"[^"\n]*"(?:\s*:\s*(?:\{[^}\n]*\}|[^\s,;)}]+))?/g
|
|
158048
|
+
];
|
|
158049
|
+
function unitsOf(text3) {
|
|
158050
|
+
const units = [];
|
|
158051
|
+
for (const pattern of UNIT_PATTERNS) for (const match of text3.matchAll(pattern)) {
|
|
158052
|
+
let to = match.index + match[0].length;
|
|
158053
|
+
if (pattern === UNIT_PATTERNS[0] && match[0].split(" ").slice(1).some((word2) => CODE_TOKEN2.test(word2))) {
|
|
158054
|
+
const rest = /^(?: [^\s,;()]+)*/.exec(text3.slice(to))[0];
|
|
158055
|
+
to += rest.length;
|
|
158056
|
+
}
|
|
158057
|
+
units.push([match.index, to]);
|
|
158036
158058
|
}
|
|
158037
|
-
|
|
158038
|
-
return lines;
|
|
158059
|
+
return units;
|
|
158039
158060
|
}
|
|
158040
|
-
|
|
158041
|
-
|
|
158042
|
-
|
|
158043
|
-
|
|
158044
|
-
|
|
158045
|
-
|
|
158046
|
-
|
|
158047
|
-
|
|
158048
|
-
|
|
158061
|
+
var wholeLine = (text3) => WHOLE_LINE_SIGNS.test(String(text3));
|
|
158062
|
+
var wrapWidth = (columns) => Number.isSafeInteger(columns) && columns >= 40 ? columns - 1 : void 0;
|
|
158063
|
+
function columnsOf3(text3) {
|
|
158064
|
+
let column = 0;
|
|
158065
|
+
for (const char of String(text3)) column = char === " " ? column - column % 8 + 8 : column + 1;
|
|
158066
|
+
return column;
|
|
158067
|
+
}
|
|
158068
|
+
function wrapWords(text3, firstPrefix, restPrefix, width) {
|
|
158069
|
+
const kept3 = unitsOf(text3);
|
|
158070
|
+
const inside = (at) => kept3.some(([from, to]) => at > from && at < to);
|
|
158071
|
+
const segments = [];
|
|
158072
|
+
let start = 0;
|
|
158073
|
+
for (let at = 1; at < text3.length - 1; at += 1) {
|
|
158074
|
+
if (text3[at] === " " && text3[at + 1] !== " " && text3[at - 1] !== " " && !inside(at)) {
|
|
158075
|
+
segments.push(text3.slice(start, at));
|
|
158076
|
+
start = at + 1;
|
|
158077
|
+
}
|
|
158078
|
+
}
|
|
158079
|
+
segments.push(text3.slice(start));
|
|
158080
|
+
const pieces = [];
|
|
158081
|
+
let piece = segments[0];
|
|
158082
|
+
for (const segment of segments.slice(1)) {
|
|
158083
|
+
const prefix = pieces.length ? restPrefix : firstPrefix;
|
|
158084
|
+
if (columnsOf3(`${prefix}${piece} ${segment}`) > width) {
|
|
158085
|
+
pieces.push(piece);
|
|
158086
|
+
piece = segment;
|
|
158087
|
+
} else piece = `${piece} ${segment}`;
|
|
158088
|
+
}
|
|
158089
|
+
pieces.push(piece);
|
|
158090
|
+
return pieces;
|
|
158091
|
+
}
|
|
158092
|
+
function wrapSetupLine(line, paint2, width) {
|
|
158093
|
+
if (!width || line.startsWith("\r") || columnsOf3(line) <= width || line.includes("\x1B[") || PROGRESS.test(line)) return void 0;
|
|
158094
|
+
const row = !CONFIG_LINE.test(line) && COLUMN_ROW.exec(line);
|
|
158095
|
+
const isRow = row && !PATH_START.test(row[2]) && (!wholeLine(line) || row[3].length >= ROW_GAP && wholeLine(row[2]) && !CODE_WORDS.test(row[4]));
|
|
158096
|
+
if (isRow) {
|
|
158097
|
+
const [, indent2, first2, gap, about] = row;
|
|
158098
|
+
const head = `${indent2}${first2}${gap}`;
|
|
158099
|
+
const cls = COMMAND.test(line) ? "brass" : LABEL.test(line) ? "bone" : "dim";
|
|
158100
|
+
const firstWord = /^\S+/.exec(about)[0];
|
|
158101
|
+
if (columnsOf3(`${head}${firstWord}`) <= width) {
|
|
158102
|
+
const under = " ".repeat(columnsOf3(head));
|
|
158103
|
+
const pieces3 = wrapWords(about, head, under, width);
|
|
158104
|
+
if (pieces3.length < 2) return void 0;
|
|
158105
|
+
return [paintSetupLine(`${head}${pieces3[0]}`, paint2), ...pieces3.slice(1).map((piece) => paint2([[under, ""], [piece, cls]]))].join("\n");
|
|
158106
|
+
}
|
|
158107
|
+
const pieces2 = wrapWords(about, indent2, indent2, width);
|
|
158108
|
+
return [paintSetupLine(`${indent2}${first2}`, paint2), ...pieces2.map((piece) => paint2([[indent2, ""], [piece, cls]]))].join("\n");
|
|
158109
|
+
}
|
|
158110
|
+
if (wholeLine(line)) return void 0;
|
|
158111
|
+
const indent = /^[ \t]*/.exec(line)[0];
|
|
158112
|
+
const body = line.slice(indent.length);
|
|
158113
|
+
const kind = indent ? { cls: "dim" } : DONE.test(line) ? { mark: ["\u25C6 ", "crim"], cls: "verm" } : FAIL.test(line) ? { mark: ["\u25CB ", "crim"], cls: "crim" } : WARN.test(line) ? { mark: ["! ", "verm"], cls: "verm" } : STEP.test(line) ? { mark: ["\u25C6 ", "crim"], cls: "bone" } : NEXT.test(line) ? { cls: "bone", next: true } : { cls: "dim" };
|
|
158114
|
+
const next = indent + (kind.mark ? " " : "");
|
|
158115
|
+
const pieces = wrapWords(body, kind.mark ? kind.mark[0] : indent, next, width);
|
|
158116
|
+
if (pieces.length < 2) return void 0;
|
|
158117
|
+
const first = kind.mark ? paint2([kind.mark, [pieces[0], kind.cls]]) : kind.next ? paintSetupLine(pieces[0], paint2) : paint2([[indent, ""], [pieces[0], kind.cls]]);
|
|
158118
|
+
return [first, ...pieces.slice(1).map((piece) => paint2([[next, ""], [piece, kind.cls]]))].join("\n");
|
|
158049
158119
|
}
|
|
158050
158120
|
function paintSetupLine(line, paint2, columns) {
|
|
158051
|
-
const
|
|
158052
|
-
|
|
158053
|
-
if (kind) {
|
|
158054
|
-
const indent = kind.mark ? " " : "";
|
|
158055
|
-
const pieces = wrapWords(line, width - indent.length);
|
|
158056
|
-
if (pieces.length > 1) {
|
|
158057
|
-
const first = kind.mark ? paint2([kind.mark, [pieces[0], kind.cls]]) : kind.next ? paintSetupLine(pieces[0], paint2) : paint2([[pieces[0], kind.cls]]);
|
|
158058
|
-
return [first, ...pieces.slice(1).map((piece) => paint2([[indent, ""], [piece, kind.cls]]))].join("\n");
|
|
158059
|
-
}
|
|
158060
|
-
}
|
|
158121
|
+
const wrapped = wrapSetupLine(line, paint2, wrapWidth(columns));
|
|
158122
|
+
if (wrapped !== void 0) return wrapped;
|
|
158061
158123
|
if (line === "" || line.includes("\x1B[")) return line;
|
|
158062
158124
|
if (DONE.test(line)) return paint2([["\u25C6 ", "crim"], [line, "verm"]]);
|
|
158063
158125
|
if (FAIL.test(line)) return paint2([["\u25CB ", "crim"], [line, "crim"]]);
|
|
@@ -158122,7 +158184,7 @@ var themedAsk = (ask, paint2, stream = process.stdout) => (prompt, ...rest) => {
|
|
|
158122
158184
|
const text3 = String(prompt);
|
|
158123
158185
|
if (text3.startsWith("? ") || text3.includes("\x1B[")) return ask(prompt, ...rest);
|
|
158124
158186
|
const width = stream?.isTTY ? wrapWidth(stream.columns) : void 0;
|
|
158125
|
-
const pieces = width && text3
|
|
158187
|
+
const pieces = width && columnsOf3(`? ${text3}`) > width && !wholeLine(text3) ? wrapWords(text3, "? ", " ", width) : [text3];
|
|
158126
158188
|
return ask([paint2([["? ", "crim"], [pieces[0], "bone"]]), ...pieces.slice(1).map((piece) => paint2([[" ", ""], [piece, "bone"]]))].join("\n"), ...rest);
|
|
158127
158189
|
};
|
|
158128
158190
|
function setupHeader(paint2, columns = 80, title = "set up the wallet") {
|
|
@@ -160510,7 +160572,7 @@ async function runChatCommand(values, deps) {
|
|
|
160510
160572
|
function validateMcp(values, env) {
|
|
160511
160573
|
validatePayerSession("mcp", values, env);
|
|
160512
160574
|
if (BigInt(values.get("--max-session")) < BigInt(values.get("--max-payment"))) {
|
|
160513
|
-
throw new PublicFailure(`mcp_cap_invalid: --max-session must be at least --max-payment (--max-session ${usdcFlagText(values.get("--max-session"))} is below --max-payment ${usdcFlagText(values.get("--max-payment"))}, in USDC); the
|
|
160575
|
+
throw new PublicFailure(`mcp_cap_invalid: --max-session must be at least --max-payment (--max-session ${usdcFlagText(values.get("--max-session"))} is below --max-payment ${usdcFlagText(values.get("--max-payment"))}, in USDC); the wallet did not start for your AI app and nothing was paid`);
|
|
160514
160576
|
}
|
|
160515
160577
|
if (values.has("--no-shield") && values.has("--allow-shield")) throw new UsageError("--no-shield and --allow-shield contradict each other: pass one (wallet_shield is on by default)");
|
|
160516
160578
|
if (values.has("--no-shield") && values.has("--max-shield")) throw new UsageError("--max-shield caps wallet_shield, which --no-shield turns off: pass one");
|
|
@@ -160884,7 +160946,7 @@ async function runMcp2(values, deps) {
|
|
|
160884
160946
|
const { code: code2, started } = await torRunOf(["mcp", ...values.get(MCP_RAW_ARGS), ...tunnel ? ["--proxy", tunnel] : []], deps);
|
|
160885
160947
|
if (code2 === 0) return void 0;
|
|
160886
160948
|
if (started) {
|
|
160887
|
-
throw new PublicFailure(`wallet_command_failed: the
|
|
160949
|
+
throw new PublicFailure(`wallet_command_failed: the wallet for your AI app ran behind Tor and then ended with exit code ${code2}; its own message is above. Tor was running when it started, so this is not a Tor failure, and nothing fell back to a direct connection. Fix what that message says, then start mcp again`);
|
|
160888
160950
|
}
|
|
160889
160951
|
const configPath2 = join48(torHome, "config.json");
|
|
160890
160952
|
if (deps.stdinIsTTY()) {
|
|
@@ -160895,9 +160957,9 @@ async function runMcp2(values, deps) {
|
|
|
160895
160957
|
now = { answer: false };
|
|
160896
160958
|
}
|
|
160897
160959
|
if (now.answer === "too_old") {
|
|
160898
|
-
throw new PublicFailure("mcp_tor_unavailable: your Tor program is too old, so the
|
|
160960
|
+
throw new PublicFailure("mcp_tor_unavailable: your Tor program is too old, so the wallet did not start for your AI app and nothing was paid. Its message above has the command that installs a newer Tor; then start mcp again");
|
|
160899
160961
|
}
|
|
160900
|
-
throw new PublicFailure(`mcp_tor_unavailable: your private connection (Tor) is not running, so the
|
|
160962
|
+
throw new PublicFailure(`mcp_tor_unavailable: your private connection (Tor) is not running, so the wallet did not start for your AI app and nothing was paid (the Tor run of mcp ended with exit code ${code2}; its message is above). ` + (process.platform === "win32" ? "Then start it again." : torStartText("start mcp again", { tunnel: recordedTunnelUrl(configPath2) })));
|
|
160901
160963
|
}
|
|
160902
160964
|
await deps.mcpTorDownMain({ exitCode: code2, configPath: configPath2 });
|
|
160903
160965
|
return void 0;
|
|
@@ -161117,13 +161179,13 @@ async function runMcpFirstRun(values, deps) {
|
|
|
161117
161179
|
` : "Shinjuku Shield is not set up on this machine yet (no config.json, wallet, passphrase file, or setup files).\n");
|
|
161118
161180
|
const answer = String(await deps.ask("Set up Shinjuku Shield now? (y/n) ")).trim();
|
|
161119
161181
|
if (!/^y(es)?$/i.test(answer)) {
|
|
161120
|
-
throw new PublicFailure(`mcp_not_set_up: the wallet is not set up, so the
|
|
161182
|
+
throw new PublicFailure(`mcp_not_set_up: the wallet is not set up, so the wallet did not start for your AI app and nothing was created; when you are ready, run:
|
|
161121
161183
|
${setupCli2()} setup`);
|
|
161122
161184
|
}
|
|
161123
161185
|
const setupValues = new Map(Object.entries(setupOptionsOf(values, home)).filter(([key]) => key !== "home").map(([key, value2]) => [`--${key.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)}`, value2]));
|
|
161124
161186
|
await runSetupCommand(setupValues, deps);
|
|
161125
161187
|
const after = mcpValuesAfterSetup(values, home, deps);
|
|
161126
|
-
io.err("Setup is done. The
|
|
161188
|
+
io.err("Setup is done. The wallet now runs in this terminal for an AI app (your AI app normally starts it by itself; Ctrl-C stops it).\n");
|
|
161127
161189
|
return runMcp2(after.values, after.deps);
|
|
161128
161190
|
}
|
|
161129
161191
|
let warm;
|
|
@@ -161807,10 +161869,19 @@ function claudeCodeEntryOf(deps) {
|
|
|
161807
161869
|
return void 0;
|
|
161808
161870
|
}
|
|
161809
161871
|
}
|
|
161810
|
-
|
|
161811
|
-
|
|
161872
|
+
var CLAUDE_SAID_CHARS = 2e3;
|
|
161873
|
+
function runClaude(args, program = "claude", stdio = "inherit", sink) {
|
|
161874
|
+
const options = {
|
|
161875
|
+
stdio: sink ? ["ignore", "pipe", "pipe"] : stdio,
|
|
161876
|
+
windowsHide: true,
|
|
161877
|
+
timeout: 12e4,
|
|
161878
|
+
...sink ? { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 } : {}
|
|
161879
|
+
};
|
|
161812
161880
|
const programWord = program === "claude" ? program : `"${program}"`;
|
|
161813
161881
|
const result = process.platform === "win32" && !/\.exe$/i.test(program) ? spawnSync11([programWord, ...args.map((word2) => hostShellWord(word2, "win32"))].join(" "), { ...options, shell: true }) : spawnSync11(program, args, options);
|
|
161882
|
+
if (sink) sink.text = `${result.stdout ?? ""}
|
|
161883
|
+
${result.stderr ?? ""}${result.error ? `
|
|
161884
|
+
${result.error.message}` : ""}`.trim().slice(-CLAUDE_SAID_CHARS);
|
|
161814
161885
|
return result.status ?? 1;
|
|
161815
161886
|
}
|
|
161816
161887
|
function claudeRemoveLines(program, platform) {
|
|
@@ -161942,7 +162013,8 @@ ${claudeCodeLines({ ...claudeOptions, claudeProgram }).map((line) => ` ${line}`
|
|
|
161942
162013
|
continue;
|
|
161943
162014
|
}
|
|
161944
162015
|
const quiet = (args) => (deps.runClaudeCliQuiet ?? deps.runClaudeCli)(args, claudeProgram);
|
|
161945
|
-
const
|
|
162016
|
+
const said = {};
|
|
162017
|
+
const runClaudeCli = (args) => deps.runClaudeCli(args, claudeProgram, said);
|
|
161946
162018
|
for (const old of OLD_MCP_SERVER_NAMES) {
|
|
161947
162019
|
if (quiet(["mcp", "remove", "--scope", "user", old]) === 0) io.out(`Replaced the old ${old} entry in Claude Code.
|
|
161948
162020
|
`);
|
|
@@ -161971,7 +162043,8 @@ ${claudeCodeLines({ ...claudeOptions, claudeProgram }).map((line) => ` ${line}`
|
|
|
161971
162043
|
if (status === 0) done.add(target);
|
|
161972
162044
|
const homeNow = replacedOther ? ` Claude Code now uses the wallet in ${home}; the wallet in ${otherHome} is unchanged.` : "";
|
|
161973
162045
|
io.out(status === 0 ? `${removed ? "Replaced the wallet in" : "Added the wallet to"} Claude Code, for all your folders.${homeNow} ${allowWalletChecks(deps).say} ${RESTART_APP("Claude Code")}${noStartFolderWords(target, mcpServerEntry(options))}
|
|
161974
|
-
` : `Claude Code did not
|
|
162046
|
+
` : `Claude Code did not add the wallet${said.text ? `. Claude Code said: ${said.text}` : ""}
|
|
162047
|
+
Run this yourself:
|
|
161975
162048
|
${claudeCodeLines({ ...claudeOptions, claudeProgram }).map((line) => ` ${line}`).join("\n")}
|
|
161976
162049
|
` + (removed ? `Setup removed the old ${MCP_SERVER_NAME} entry first, so Claude Code has none until that line runs.
|
|
161977
162050
|
` : `If it says the server already exists, remove that entry with this command, then run the line above:
|
|
@@ -163428,7 +163501,7 @@ var COMMANDS = [
|
|
|
163428
163501
|
},
|
|
163429
163502
|
{
|
|
163430
163503
|
name: "mcp",
|
|
163431
|
-
summary: "Run
|
|
163504
|
+
summary: "Run the wallet for an AI app on this computer, so the app can pay websites from your private balance, under caps you set.",
|
|
163432
163505
|
env: [],
|
|
163433
163506
|
flags: [
|
|
163434
163507
|
flag2("--max-payment", "<usdc>", "optional: the most one payment may cost, in USDC (0.05 = 5 cents); a tool argument can only lower it. Default no limit", { check: "atomic", usdc: true }),
|
|
@@ -167313,7 +167386,7 @@ function defaultDependencies() {
|
|
|
167313
167386
|
}),
|
|
167314
167387
|
/** claude with no output on the terminal (setup's probe of an old entry, and its remove); the exit status. */
|
|
167315
167388
|
runClaudeCliQuiet: (args, program) => runClaude(args, program, "ignore"),
|
|
167316
|
-
runClaudeCli: (args, program) => runClaude(args, program, "inherit"),
|
|
167389
|
+
runClaudeCli: (args, program, sink) => runClaude(args, program, "inherit", sink),
|
|
167317
167390
|
/**
|
|
167318
167391
|
* The --tor entry of this CLI: re-execute `args` behind Tor (proxy.mjs proves Tor first). `startedFile`
|
|
167319
167392
|
* (torRunOf) reaches the Tor run in its environment, which proxy.mjs copies from this process at the spawn.
|