shinjuku-shield 0.3.251 → 0.3.252
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 +161 -71
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.252. 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.252 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.252, 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": "458a3a7a8f9a45c34206796c14224b8dde4088c981eb817a9763b0040ca00f9b",
|
|
5
|
+
"bytes": 10870453,
|
|
6
|
+
"sourceCommit": "4ee1be42e8b86f27f49aed1d3a4a36cd199fc457",
|
|
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-19T20:19:09.417Z"
|
|
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.252",
|
|
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": "458a3a7a",
|
|
7
|
+
"shinjukuSha256": "458a3a7a8f9a45c34206796c14224b8dde4088c981eb817a9763b0040ca00f9b",
|
|
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
|
@@ -1450,7 +1450,7 @@ var require_utils = __commonJS({
|
|
|
1450
1450
|
exports.createHasher = createHasher4;
|
|
1451
1451
|
exports.createOptHasher = createOptHasher;
|
|
1452
1452
|
exports.createXOFer = createXOFer2;
|
|
1453
|
-
exports.randomBytes =
|
|
1453
|
+
exports.randomBytes = randomBytes53;
|
|
1454
1454
|
var crypto_1 = require_cryptoNode();
|
|
1455
1455
|
function isBytes4(a) {
|
|
1456
1456
|
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
@@ -1648,7 +1648,7 @@ var require_utils = __commonJS({
|
|
|
1648
1648
|
exports.wrapConstructor = createHasher4;
|
|
1649
1649
|
exports.wrapConstructorWithOpts = createOptHasher;
|
|
1650
1650
|
exports.wrapXOFConstructorWithOpts = createXOFer2;
|
|
1651
|
-
function
|
|
1651
|
+
function randomBytes53(bytesLength = 32) {
|
|
1652
1652
|
if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === "function") {
|
|
1653
1653
|
return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
|
|
1654
1654
|
}
|
|
@@ -3820,7 +3820,7 @@ var require_edwards = __commonJS({
|
|
|
3820
3820
|
});
|
|
3821
3821
|
const { prehash } = eddsaOpts;
|
|
3822
3822
|
const { BASE: BASE2, Fp: Fp3, Fn: Fn2 } = Point3;
|
|
3823
|
-
const
|
|
3823
|
+
const randomBytes53 = eddsaOpts.randomBytes || utils_ts_1.randomBytes;
|
|
3824
3824
|
const adjustScalarBytes2 = eddsaOpts.adjustScalarBytes || ((bytes2) => bytes2);
|
|
3825
3825
|
const domain3 = eddsaOpts.domain || ((data, ctx, phflag) => {
|
|
3826
3826
|
(0, utils_ts_1._abool2)(phflag, "phflag");
|
|
@@ -3902,7 +3902,7 @@ var require_edwards = __commonJS({
|
|
|
3902
3902
|
signature: 2 * _size,
|
|
3903
3903
|
seed: _size
|
|
3904
3904
|
};
|
|
3905
|
-
function randomSecretKey(seed =
|
|
3905
|
+
function randomSecretKey(seed = randomBytes53(lengths.seed)) {
|
|
3906
3906
|
return (0, utils_ts_1._abytes2)(seed, lengths.seed, "seed");
|
|
3907
3907
|
}
|
|
3908
3908
|
function keygen(seed) {
|
|
@@ -7826,7 +7826,7 @@ var require_utils3 = __commonJS({
|
|
|
7826
7826
|
exports.createHasher = createHasher4;
|
|
7827
7827
|
exports.createOptHasher = createOptHasher;
|
|
7828
7828
|
exports.createXOFer = createXOFer2;
|
|
7829
|
-
exports.randomBytes =
|
|
7829
|
+
exports.randomBytes = randomBytes53;
|
|
7830
7830
|
var crypto_1 = require_cryptoNode2();
|
|
7831
7831
|
function isBytes4(a) {
|
|
7832
7832
|
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
@@ -8024,7 +8024,7 @@ var require_utils3 = __commonJS({
|
|
|
8024
8024
|
exports.wrapConstructor = createHasher4;
|
|
8025
8025
|
exports.wrapConstructorWithOpts = createOptHasher;
|
|
8026
8026
|
exports.wrapXOFConstructorWithOpts = createXOFer2;
|
|
8027
|
-
function
|
|
8027
|
+
function randomBytes53(bytesLength = 32) {
|
|
8028
8028
|
if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === "function") {
|
|
8029
8029
|
return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
|
|
8030
8030
|
}
|
|
@@ -19590,7 +19590,7 @@ var require_websocket = __commonJS({
|
|
|
19590
19590
|
var http3 = __require("http");
|
|
19591
19591
|
var net5 = __require("net");
|
|
19592
19592
|
var tls2 = __require("tls");
|
|
19593
|
-
var { randomBytes:
|
|
19593
|
+
var { randomBytes: randomBytes53, createHash: createHash52 } = __require("crypto");
|
|
19594
19594
|
var { Duplex: Duplex2, Readable: Readable2 } = __require("stream");
|
|
19595
19595
|
var { URL: URL4 } = __require("url");
|
|
19596
19596
|
var PerMessageDeflate = require_permessage_deflate();
|
|
@@ -20128,7 +20128,7 @@ var require_websocket = __commonJS({
|
|
|
20128
20128
|
}
|
|
20129
20129
|
}
|
|
20130
20130
|
const defaultPort = isSecure ? 443 : 80;
|
|
20131
|
-
const key =
|
|
20131
|
+
const key = randomBytes53(16).toString("base64");
|
|
20132
20132
|
const request = isSecure ? https2.request : http3.request;
|
|
20133
20133
|
const protocolSet = /* @__PURE__ */ new Set();
|
|
20134
20134
|
let perMessageDeflate;
|
|
@@ -23738,7 +23738,7 @@ var require_weierstrass = __commonJS({
|
|
|
23738
23738
|
bits2int: "function",
|
|
23739
23739
|
bits2int_modN: "function"
|
|
23740
23740
|
});
|
|
23741
|
-
const
|
|
23741
|
+
const randomBytes53 = ecdsaOpts.randomBytes || utils_ts_1.randomBytes;
|
|
23742
23742
|
const hmac4 = ecdsaOpts.hmac || ((key, ...msgs) => (0, hmac_js_1.hmac)(hash12, key, (0, utils_ts_1.concatBytes)(...msgs)));
|
|
23743
23743
|
const { Fp: Fp3, Fn: Fn2 } = Point3;
|
|
23744
23744
|
const { ORDER: CURVE_ORDER, BITS: fnBits } = Fn2;
|
|
@@ -23893,7 +23893,7 @@ var require_weierstrass = __commonJS({
|
|
|
23893
23893
|
const d = _normFnElement2(Fn2, privateKey);
|
|
23894
23894
|
const seedArgs = [int2octets(d), int2octets(h1int)];
|
|
23895
23895
|
if (extraEntropy != null && extraEntropy !== false) {
|
|
23896
|
-
const e14 = extraEntropy === true ?
|
|
23896
|
+
const e14 = extraEntropy === true ? randomBytes53(lengths.secretKey) : extraEntropy;
|
|
23897
23897
|
seedArgs.push((0, utils_ts_1.ensureBytes)("extraEntropy", e14));
|
|
23898
23898
|
}
|
|
23899
23899
|
const seed = (0, utils_ts_1.concatBytes)(...seedArgs);
|
|
@@ -49866,7 +49866,7 @@ function eddsa(Point3, cHash, eddsaOpts = {}) {
|
|
|
49866
49866
|
});
|
|
49867
49867
|
const { prehash } = eddsaOpts;
|
|
49868
49868
|
const { BASE: BASE2, Fp: Fp3, Fn: Fn2 } = Point3;
|
|
49869
|
-
const
|
|
49869
|
+
const randomBytes53 = eddsaOpts.randomBytes || randomBytes4;
|
|
49870
49870
|
const adjustScalarBytes2 = eddsaOpts.adjustScalarBytes || ((bytes2) => bytes2);
|
|
49871
49871
|
const domain3 = eddsaOpts.domain || ((data, ctx, phflag) => {
|
|
49872
49872
|
_abool2(phflag, "phflag");
|
|
@@ -49948,7 +49948,7 @@ function eddsa(Point3, cHash, eddsaOpts = {}) {
|
|
|
49948
49948
|
signature: 2 * _size,
|
|
49949
49949
|
seed: _size
|
|
49950
49950
|
};
|
|
49951
|
-
function randomSecretKey(seed =
|
|
49951
|
+
function randomSecretKey(seed = randomBytes53(lengths.seed)) {
|
|
49952
49952
|
return _abytes2(seed, lengths.seed, "seed");
|
|
49953
49953
|
}
|
|
49954
49954
|
function keygen(seed) {
|
|
@@ -70330,7 +70330,7 @@ function ecdsa(Point3, hash12, ecdsaOpts = {}) {
|
|
|
70330
70330
|
bits2int: "function",
|
|
70331
70331
|
bits2int_modN: "function"
|
|
70332
70332
|
});
|
|
70333
|
-
const
|
|
70333
|
+
const randomBytes53 = ecdsaOpts.randomBytes || randomBytes4;
|
|
70334
70334
|
const hmac4 = ecdsaOpts.hmac || ((key, ...msgs) => hmac3(hash12, key, concatBytes3(...msgs)));
|
|
70335
70335
|
const { Fp: Fp3, Fn: Fn2 } = Point3;
|
|
70336
70336
|
const { ORDER: CURVE_ORDER, BITS: fnBits } = Fn2;
|
|
@@ -70485,7 +70485,7 @@ function ecdsa(Point3, hash12, ecdsaOpts = {}) {
|
|
|
70485
70485
|
const d = _normFnElement(Fn2, privateKey);
|
|
70486
70486
|
const seedArgs = [int2octets(d), int2octets(h1int)];
|
|
70487
70487
|
if (extraEntropy != null && extraEntropy !== false) {
|
|
70488
|
-
const e14 = extraEntropy === true ?
|
|
70488
|
+
const e14 = extraEntropy === true ? randomBytes53(lengths.secretKey) : extraEntropy;
|
|
70489
70489
|
seedArgs.push(ensureBytes("extraEntropy", e14));
|
|
70490
70490
|
}
|
|
70491
70491
|
const seed = concatBytes3(...seedArgs);
|
|
@@ -79179,10 +79179,10 @@ async function createKeyPairFromBytes(bytes2, extractable = false) {
|
|
|
79179
79179
|
),
|
|
79180
79180
|
createPrivateKeyFromBytes(bytes2.slice(0, 32), extractable)
|
|
79181
79181
|
]);
|
|
79182
|
-
const
|
|
79183
|
-
crypto.getRandomValues(
|
|
79184
|
-
const signedData = await signBytes(privateKey,
|
|
79185
|
-
const isValid2 = await verifySignature3(publicKey3, signedData,
|
|
79182
|
+
const randomBytes53 = new Uint8Array(32);
|
|
79183
|
+
crypto.getRandomValues(randomBytes53);
|
|
79184
|
+
const signedData = await signBytes(privateKey, randomBytes53);
|
|
79185
|
+
const isValid2 = await verifySignature3(publicKey3, signedData, randomBytes53);
|
|
79186
79186
|
if (!isValid2) {
|
|
79187
79187
|
throw new SolanaError(SOLANA_ERROR__KEYS__PUBLIC_KEY_MUST_MATCH_PRIVATE_KEY);
|
|
79188
79188
|
}
|
|
@@ -126224,6 +126224,7 @@ function refusalSay(a, tool, again, npmVersion) {
|
|
|
126224
126224
|
return `Nothing was ${code2 === PAY_BALANCE_EMPTY_CODE ? "paid" : "sent"}: your private balance is 0 USDC. ${way[0].toUpperCase()}${way.slice(1)}`;
|
|
126225
126225
|
}
|
|
126226
126226
|
if (code2 === "mcp_unshield_balance_empty") return emptyUnshieldSay(a);
|
|
126227
|
+
if (code2 === "mcp_pay_me_link") return "Nothing was paid: this is a Shinjuku pay-me link. It is paid from your private balance as a private send, not as a web service.";
|
|
126227
126228
|
if (tool === "wallet_unshield" && code2 === "mcp_argument_invalid" && /^to is missing/.test(String(a.detail ?? ""))) {
|
|
126228
126229
|
return /more than one owner address/.test(String(a.detail)) ? "Nothing was sent. Say which of your own addresses to send to." : "Nothing was sent. For your own wallet, copy its Solana address from the wallet app or exchange you use, and paste it here.";
|
|
126229
126230
|
}
|
|
@@ -127376,9 +127377,12 @@ function withKeepIdNote(output2) {
|
|
|
127376
127377
|
} catch {
|
|
127377
127378
|
return output2;
|
|
127378
127379
|
}
|
|
127379
|
-
if (!parsed2 || typeof parsed2 !== "object" || Array.isArray(parsed2) || typeof parsed2.next !== "string"
|
|
127380
|
-
|
|
127381
|
-
|
|
127380
|
+
if (!parsed2 || typeof parsed2 !== "object" || Array.isArray(parsed2) || typeof parsed2.next !== "string") return output2;
|
|
127381
|
+
const done = parsed2.ok === true && parsed2.done === true && !parsed2.next.includes(DONE_NOTE);
|
|
127382
|
+
const keepId = !parsed2.next.includes(KEEP_ID_NOTE) && (/"(?:requestId|newRequestId)"\s*:\s*"[^"]{4,}"/.test(block.text) || /request_id "[^"]+"/.test(parsed2.next));
|
|
127383
|
+
if (!done && !keepId) return output2;
|
|
127384
|
+
const notes = [...done ? [DONE_NOTE] : [], ...keepId ? [KEEP_ID_NOTE] : []].join(" ");
|
|
127385
|
+
return withFirstText(output2, block, { ...parsed2, next: `${parsed2.next.replace(/[.\s]+$/, "")}. ${notes}` });
|
|
127382
127386
|
}
|
|
127383
127387
|
function plainFields(parsed2, toolName) {
|
|
127384
127388
|
const a = { ...parsed2 };
|
|
@@ -127405,7 +127409,7 @@ function plainFields(parsed2, toolName) {
|
|
|
127405
127409
|
function withSay(tool, options = {}) {
|
|
127406
127410
|
return { ...tool, run: async (args, ctx) => withKeepIdNote(addSay(await tool.run(args, ctx), tool.name, options)) };
|
|
127407
127411
|
}
|
|
127408
|
-
var SAY_MAX_WORDS, CHECK_FIRST, MONEY_TOOLS, nextStepOf, DECIMALS, ATOMIC9, SAY_FIRST, SAY_BANNED, CODE_TOKEN, LONG_NUMBER, AI_FLOAT_REFUSED, MOVE_LINE, minutesText, ADD_FUNDS_NEWS_WORDS, PAY_ME_PRIVATE_NEWS_WORDS, ageWords, MOVING_ROLES, CLOSE_LATER, PAY_CAP_CODES, raiseLine, MOVE_CAP_CODES, LIMIT_MOVE_TOOLS, OWNER_LIMIT_CODES, BUSY, SHIELD_TOOLS, PAY_BALANCE_EMPTY_CODE, PAY_NOTHING_SPENDABLE_CODE, TOR_BLOCKED_STEP, words, firstFit, doneInText, positive, shortAddress, str, refundInFlight, sellerAnswered, urlAnswered, OWN_WORK_WORDS, dayLimitWords, DISCOVER_LIST_NAMES, listNames, discoverCutRows, CONFIRMED_SEND_TOOLS, KEEP_ID_NOTE, BALANCE_READ_DOES, SAFE_BALANCE_READ;
|
|
127412
|
+
var SAY_MAX_WORDS, CHECK_FIRST, MONEY_TOOLS, nextStepOf, DECIMALS, ATOMIC9, SAY_FIRST, SAY_BANNED, CODE_TOKEN, LONG_NUMBER, AI_FLOAT_REFUSED, MOVE_LINE, minutesText, ADD_FUNDS_NEWS_WORDS, PAY_ME_PRIVATE_NEWS_WORDS, ageWords, MOVING_ROLES, CLOSE_LATER, PAY_CAP_CODES, raiseLine, MOVE_CAP_CODES, LIMIT_MOVE_TOOLS, OWNER_LIMIT_CODES, BUSY, SHIELD_TOOLS, PAY_BALANCE_EMPTY_CODE, PAY_NOTHING_SPENDABLE_CODE, TOR_BLOCKED_STEP, words, firstFit, doneInText, positive, shortAddress, str, refundInFlight, sellerAnswered, urlAnswered, OWN_WORK_WORDS, dayLimitWords, DISCOVER_LIST_NAMES, listNames, discoverCutRows, CONFIRMED_SEND_TOOLS, KEEP_ID_NOTE, BALANCE_READ_DOES, SAFE_BALANCE_READ, DONE_NOTE;
|
|
127409
127413
|
var init_say = __esm({
|
|
127410
127414
|
"wallet/src/mcp/say.mjs"() {
|
|
127411
127415
|
"use strict";
|
|
@@ -127518,6 +127522,7 @@ var init_say = __esm({
|
|
|
127518
127522
|
KEEP_ID_NOTE = "Keep request_id values for your own calls; never show one to the user.";
|
|
127519
127523
|
BALANCE_READ_DOES = "starts no payment or new send; it finishes what is under way: added USDC moves into the user's own private balance, and a stopped earlier send goes on to its address";
|
|
127520
127524
|
SAFE_BALANCE_READ = `call wallet_balance yourself (do not make the user ask; a balance read reads the chain, ${BALANCE_READ_DOES})`;
|
|
127525
|
+
DONE_NOTE = "It is done: do not call this tool again for it.";
|
|
127521
127526
|
}
|
|
127522
127527
|
});
|
|
127523
127528
|
|
|
@@ -133389,6 +133394,34 @@ var init_inference = __esm({
|
|
|
133389
133394
|
}
|
|
133390
133395
|
});
|
|
133391
133396
|
|
|
133397
|
+
// wallet/src/inference/modelNames.mjs
|
|
133398
|
+
function plainModelName(id, { shinjukuAi = false } = {}) {
|
|
133399
|
+
const company = typeof id === "string" ? modelFamily(id) : void 0;
|
|
133400
|
+
if (!company) return typeof id === "string" ? id : void 0;
|
|
133401
|
+
return shinjukuAi ? `${company} Private` : company;
|
|
133402
|
+
}
|
|
133403
|
+
var MODEL_FAMILIES, modelFamily;
|
|
133404
|
+
var init_modelNames = __esm({
|
|
133405
|
+
"wallet/src/inference/modelNames.mjs"() {
|
|
133406
|
+
"use strict";
|
|
133407
|
+
MODEL_FAMILIES = Object.freeze([
|
|
133408
|
+
["claude", "Claude"],
|
|
133409
|
+
["kimi", "Kimi"],
|
|
133410
|
+
["deepseek", "DeepSeek"],
|
|
133411
|
+
["qwen", "Qwen"],
|
|
133412
|
+
["gpt", "GPT"],
|
|
133413
|
+
["gemini", "Gemini"],
|
|
133414
|
+
["gemma", "Gemma"],
|
|
133415
|
+
["grok", "Grok"],
|
|
133416
|
+
["llama", "Llama"],
|
|
133417
|
+
["mistral", "Mistral"],
|
|
133418
|
+
["glm", "GLM"],
|
|
133419
|
+
["minimax", "MiniMax"]
|
|
133420
|
+
]);
|
|
133421
|
+
modelFamily = (id) => MODEL_FAMILIES.find(([start]) => String(id).toLowerCase().replace(/^e2ee-/, "").startsWith(start))?.[1];
|
|
133422
|
+
}
|
|
133423
|
+
});
|
|
133424
|
+
|
|
133392
133425
|
// wallet/src/inbound/client.mjs
|
|
133393
133426
|
var client_exports = {};
|
|
133394
133427
|
__export(client_exports, {
|
|
@@ -146579,11 +146612,12 @@ function view(record) {
|
|
|
146579
146612
|
const seller = privateSend ? PRIVATE_SEND_WORDS : shownUrl(url);
|
|
146580
146613
|
const sellerHost = privateSend ? null : url?.host ?? null;
|
|
146581
146614
|
const privateAi = url !== null && isPrivateAiUrl(url.href);
|
|
146615
|
+
const modelWords = (model3) => plainModelName(model3, { shinjukuAi: url !== null && isShinjukuAiUrl(url.href) }) ?? "model not recorded";
|
|
146582
146616
|
if (record.schema === FLOAT_PAYMENT_SCHEMA) {
|
|
146583
146617
|
const kind2 = record.receiptKind === "inference" || record.receiptKind === "x402" ? record.receiptKind : url === null ? null : privateAi ? "inference" : "x402";
|
|
146584
146618
|
const model3 = typeof record.inferenceModel === "string" && MODEL_ID2.test(record.inferenceModel) ? record.inferenceModel : null;
|
|
146585
146619
|
const from2 = Object.hasOwn(PAID_FROM_WORDS, String(record.paidFrom)) ? PAID_FROM_WORDS[record.paidFrom] : void 0;
|
|
146586
|
-
const item2 = kind2 === "inference" ? `private AI: ${model3
|
|
146620
|
+
const item2 = kind2 === "inference" ? `private AI: ${modelWords(model3)}${from2 ? ` (${from2})` : ""}` : seller === null ? null : cut(method ? `${method} ${seller}` : seller);
|
|
146587
146621
|
return {
|
|
146588
146622
|
kind: kind2,
|
|
146589
146623
|
seller,
|
|
@@ -146603,7 +146637,7 @@ function view(record) {
|
|
|
146603
146637
|
const kind = url === null ? null : record.receiptKind === "inference" || privateAi ? "inference" : "x402";
|
|
146604
146638
|
const model2 = typeof record.inferenceModel === "string" && MODEL_ID2.test(record.inferenceModel) ? record.inferenceModel : null;
|
|
146605
146639
|
const from = Object.hasOwn(PAID_FROM_WORDS, String(record.paidFrom)) ? PAID_FROM_WORDS[record.paidFrom] : void 0;
|
|
146606
|
-
const item = kind === "inference" ? `private AI: ${model2
|
|
146640
|
+
const item = kind === "inference" ? `private AI: ${modelWords(model2)}${from ? ` (${from})` : ""}` : seller === null ? null : cut(method ? `${method} ${seller}` : seller);
|
|
146607
146641
|
if (record.paymentRequired !== void 0) {
|
|
146608
146642
|
const total2 = atomic4(record.paymentRequired?.accepts?.find((entry) => entry?.scheme === "shielded-exact")?.amount);
|
|
146609
146643
|
return {
|
|
@@ -146651,6 +146685,7 @@ var init_receiptView = __esm({
|
|
|
146651
146685
|
"use strict";
|
|
146652
146686
|
init_floatPay();
|
|
146653
146687
|
init_providers();
|
|
146688
|
+
init_modelNames();
|
|
146654
146689
|
SHINJUKU_FACILITATOR = "pay.shinjukustaition.com (Shinjuku, the private payment service)";
|
|
146655
146690
|
DEFAULT_FACILITATOR_HOST = "pay.shinjukustaition.com";
|
|
146656
146691
|
ATOMIC14 = /^[0-9]{1,31}$/;
|
|
@@ -147107,6 +147142,13 @@ function privateSellerHostsAllowed() {
|
|
|
147107
147142
|
}
|
|
147108
147143
|
function checkUrl(value2) {
|
|
147109
147144
|
if (typeof value2 !== "string" || !value2) return { refusal: ["mcp_argument_invalid", "url is required", "pass url as an absolute https URL"] };
|
|
147145
|
+
if (isPayLink(value2)) {
|
|
147146
|
+
return { refusal: [
|
|
147147
|
+
"mcp_pay_me_link",
|
|
147148
|
+
"this is a Shinjuku pay-me link, not a paid web service, so nothing was paid",
|
|
147149
|
+
"call wallet_unshield with to set to this same link; it asks the user once and pays it from the private balance"
|
|
147150
|
+
] };
|
|
147151
|
+
}
|
|
147110
147152
|
let url;
|
|
147111
147153
|
try {
|
|
147112
147154
|
url = new URL(value2);
|
|
@@ -149761,7 +149803,7 @@ ${key}`).digest("hex").slice(0, 40)}.json`);
|
|
|
149761
149803
|
const withPoolSwitch = (tool) => ({ ...tool, run: async (...args) => {
|
|
149762
149804
|
let output2;
|
|
149763
149805
|
const paying = tool.name === "pay_for_service";
|
|
149764
|
-
const moving = tool.annotations?.readOnlyHint !== true;
|
|
149806
|
+
const moving = tool.annotations?.readOnlyHint !== true || MOVES_WHILE_READING.has(tool.name);
|
|
149765
149807
|
const spending = SPEND_TOOLS.has(tool.name);
|
|
149766
149808
|
callsInFlight += 1;
|
|
149767
149809
|
if (spending) spendCallsInFlight += 1;
|
|
@@ -152323,7 +152365,7 @@ ${canonical6}`;
|
|
|
152323
152365
|
const prefixes = [FLOAT_PAYMENT_WAL_PREFIX2, RESOURCE_PAYMENT_WAL_PREFIX2, POCKET_PAYMENT_WAL_PREFIX];
|
|
152324
152366
|
const timed = store.listWal().filter((name) => prefixes.some((prefix) => name.startsWith(prefix))).map((name) => ({ name, ms: walTimeMs(store, name) })).sort((left, right) => right.ms - left.ms);
|
|
152325
152367
|
for (let take = 16; ; take *= 2) {
|
|
152326
|
-
const rows2 = paymentRows(store, timed.slice(0, take).map((entry) => entry.name)).filter((row) => row.state === void 0 && row.at >= 0 && /^[1-9][0-9]*$/.test(String(row.amountAtomic ?? ""))).sort((left, right) => right.at - left.at).slice(0, count3);
|
|
152368
|
+
const rows2 = paymentRows(store, timed.slice(0, take).map((entry) => entry.name)).filter((row) => (row.state === void 0 || row.state === "payment_not_confirmed") && row.at >= 0 && /^[1-9][0-9]*$/.test(String(row.amountAtomic ?? ""))).sort((left, right) => right.at - left.at).slice(0, count3);
|
|
152327
152369
|
if (take >= timed.length) return rows2;
|
|
152328
152370
|
const nextMs = timed[take].ms;
|
|
152329
152371
|
if (rows2.length === count3 && nextMs >= 0 && nextMs + 2e3 < rows2[count3 - 1].at) return rows2;
|
|
@@ -159224,7 +159266,11 @@ ${canonical6}`;
|
|
|
159224
159266
|
},
|
|
159225
159267
|
additionalProperties: false
|
|
159226
159268
|
},
|
|
159227
|
-
|
|
159269
|
+
// readOnlyHint true (row 23 on 0.3.251, Hermes: a status read asked for approval, a second box for one link): it
|
|
159270
|
+
// reads, and shields USDC that reached the user's own link into the user's own private balance, as wallet_balance
|
|
159271
|
+
// does (also readOnlyHint true); "close" moves nothing. The wallet still counts its calls as money moves
|
|
159272
|
+
// (MOVES_WHILE_READING). Session-made, 2026-11-19 (its commit names it).
|
|
159273
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
159228
159274
|
async run(args, { progress: progress2 } = {}) {
|
|
159229
159275
|
const startedAt = Date.now();
|
|
159230
159276
|
const given = args?.request_id;
|
|
@@ -160381,21 +160427,6 @@ ${canonical6}`;
|
|
|
160381
160427
|
}, "inference_chat")), paidStore);
|
|
160382
160428
|
}
|
|
160383
160429
|
};
|
|
160384
|
-
const MODEL_FAMILIES = [
|
|
160385
|
-
["claude", "Claude"],
|
|
160386
|
-
["kimi", "Kimi"],
|
|
160387
|
-
["deepseek", "DeepSeek"],
|
|
160388
|
-
["qwen", "Qwen"],
|
|
160389
|
-
["gpt", "GPT"],
|
|
160390
|
-
["gemini", "Gemini"],
|
|
160391
|
-
["gemma", "Gemma"],
|
|
160392
|
-
["grok", "Grok"],
|
|
160393
|
-
["llama", "Llama"],
|
|
160394
|
-
["mistral", "Mistral"],
|
|
160395
|
-
["glm", "GLM"],
|
|
160396
|
-
["minimax", "MiniMax"]
|
|
160397
|
-
];
|
|
160398
|
-
const modelFamily = (id) => MODEL_FAMILIES.find(([start]) => String(id).toLowerCase().replace(/^e2ee-/, "").startsWith(start))?.[1];
|
|
160399
160430
|
const listedModelNames = /* @__PURE__ */ new Map();
|
|
160400
160431
|
function chatModelName(id) {
|
|
160401
160432
|
if (listedModelNames.has(id)) return listedModelNames.get(id);
|
|
@@ -161922,7 +161953,7 @@ function createSetupTools({
|
|
|
161922
161953
|
finalPending
|
|
161923
161954
|
};
|
|
161924
161955
|
}
|
|
161925
|
-
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, USER_ACTION_TOOLS, JOIN_STEP_MS, sleep2, PROGRESS_EVERY_MS2, READ_BUDGET_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;
|
|
161956
|
+
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, 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;
|
|
161926
161957
|
var init_tools = __esm({
|
|
161927
161958
|
"wallet/src/mcp/tools.mjs"() {
|
|
161928
161959
|
"use strict";
|
|
@@ -161940,6 +161971,7 @@ var init_tools = __esm({
|
|
|
161940
161971
|
init_models();
|
|
161941
161972
|
init_inference();
|
|
161942
161973
|
init_liveModels();
|
|
161974
|
+
init_modelNames();
|
|
161943
161975
|
init_balance();
|
|
161944
161976
|
init_book2();
|
|
161945
161977
|
init_client2();
|
|
@@ -162115,6 +162147,7 @@ var init_tools = __esm({
|
|
|
162115
162147
|
JOIN_TIME_MS = Object.freeze({ joinLikely: 22e3, joinMost: 4e4, sendLikely: 35e3, sendMost: 5e4 });
|
|
162116
162148
|
JOIN_NUDGE_QUIET_MS = 15e3;
|
|
162117
162149
|
SPEND_TOOLS = /* @__PURE__ */ new Set(["pay_for_service", "inference_chat", "wallet_unshield"]);
|
|
162150
|
+
MOVES_WHILE_READING = /* @__PURE__ */ new Set(["wallet_pay_me_status"]);
|
|
162118
162151
|
USER_ACTION_TOOLS = /* @__PURE__ */ new Set(["pay_for_service", "wallet_balance", "wallet_add_funds", "wallet_shield", "wallet_unshield"]);
|
|
162119
162152
|
JOIN_STEP_MS = 1e4;
|
|
162120
162153
|
sleep2 = (ms) => new Promise((resolve46) => {
|
|
@@ -171658,7 +171691,7 @@ var init_torMissingMcp = __esm({
|
|
|
171658
171691
|
|
|
171659
171692
|
// wallet/src/seller/setup.mjs
|
|
171660
171693
|
import http2 from "node:http";
|
|
171661
|
-
import { createHash as createHash50, randomBytes as
|
|
171694
|
+
import { createHash as createHash50, randomBytes as randomBytes50 } from "node:crypto";
|
|
171662
171695
|
import { spawnSync as spawnSync14 } from "node:child_process";
|
|
171663
171696
|
import { join as join55, resolve as resolve41 } from "node:path";
|
|
171664
171697
|
function separateSellerHome(env, userHome) {
|
|
@@ -171756,7 +171789,7 @@ Or run ${cli2()} seller setup again and choose no Tor.`
|
|
|
171756
171789
|
}
|
|
171757
171790
|
const tagged = new URL(tunnel);
|
|
171758
171791
|
tagged.username = "tor";
|
|
171759
|
-
tagged.password =
|
|
171792
|
+
tagged.password = randomBytes50(16).toString("hex");
|
|
171760
171793
|
const dispatcher = proxyDispatcher(proxyDispatcherClass(), tagged.href.replace(/\/$/, ""));
|
|
171761
171794
|
return {
|
|
171762
171795
|
fetch: (input, init = {}) => fetch(input, { ...init, dispatcher }),
|
|
@@ -171859,7 +171892,7 @@ function orphanRefusal(folder) {
|
|
|
171859
171892
|
return new SellerRefusal("seller_wallet_missing", `A seller set up earlier keeps its records in ${folder}, but its wallet is not there, so setup makes no new wallet beside them; nothing was changed. Restore that wallet from its backup into that folder (${setupCli()} restore), or move that folder away (keep it: it holds that wallet's sales) and run ${cli2()} seller setup again.`);
|
|
171860
171893
|
}
|
|
171861
171894
|
function writePrivate(path, text3) {
|
|
171862
|
-
const temp = `${path}.${
|
|
171895
|
+
const temp = `${path}.${randomBytes50(4).toString("hex")}.tmp`;
|
|
171863
171896
|
try {
|
|
171864
171897
|
writeRecoveryFile(temp, text3);
|
|
171865
171898
|
renameSync(temp, path);
|
|
@@ -172548,7 +172581,7 @@ var init_setup = __esm({
|
|
|
172548
172581
|
});
|
|
172549
172582
|
|
|
172550
172583
|
// wallet/src/seller/runner.mjs
|
|
172551
|
-
import { randomBytes as
|
|
172584
|
+
import { randomBytes as randomBytes51 } from "node:crypto";
|
|
172552
172585
|
import { spawnSync as spawnSync15 } from "node:child_process";
|
|
172553
172586
|
import { hostname as hostname3 } from "node:os";
|
|
172554
172587
|
import { dirname as dirname48, join as join56 } from "node:path";
|
|
@@ -172558,7 +172591,7 @@ function paidRequestWaitMs(config) {
|
|
|
172558
172591
|
}
|
|
172559
172592
|
function writeAtomic6(path, text3) {
|
|
172560
172593
|
mkdirSync(dirname48(path), { recursive: true, mode: 448 });
|
|
172561
|
-
const temp = `${path}.${
|
|
172594
|
+
const temp = `${path}.${randomBytes51(4).toString("hex")}.tmp`;
|
|
172562
172595
|
writeFileSync(temp, text3, { mode: 384, flag: "wx" });
|
|
172563
172596
|
try {
|
|
172564
172597
|
renameSync(temp, path);
|
|
@@ -172809,7 +172842,7 @@ async function startSellerInBackground({
|
|
|
172809
172842
|
rmSync(sellerStopPath(home), { force: true });
|
|
172810
172843
|
} catch {
|
|
172811
172844
|
}
|
|
172812
|
-
const launchId =
|
|
172845
|
+
const launchId = randomBytes51(16).toString("hex");
|
|
172813
172846
|
const childEnv = childRunProxy(env).env;
|
|
172814
172847
|
for (const name of Object.keys(childEnv)) {
|
|
172815
172848
|
if (ENV_DROP.includes(name) || ENV_DROP_PREFIX.some((prefix) => name.startsWith(prefix))) delete childEnv[name];
|
|
@@ -173623,7 +173656,7 @@ init_emptyBalance();
|
|
|
173623
173656
|
init_knownZero();
|
|
173624
173657
|
init_publicRead();
|
|
173625
173658
|
init_timing();
|
|
173626
|
-
import { randomBytes as
|
|
173659
|
+
import { randomBytes as randomBytes52 } from "node:crypto";
|
|
173627
173660
|
import { dirname as dirname49, join as join60, resolve as resolve44 } from "node:path";
|
|
173628
173661
|
import { spawn as spawn13 } from "node:child_process";
|
|
173629
173662
|
import { fileURLToPath as fileURLToPath24 } from "node:url";
|
|
@@ -177140,6 +177173,7 @@ init_backup();
|
|
|
177140
177173
|
// wallet/src/setup/hostCheck.mjs
|
|
177141
177174
|
init_fs();
|
|
177142
177175
|
import { spawn as spawn12, spawnSync as spawnSync13 } from "node:child_process";
|
|
177176
|
+
import { randomBytes as randomBytes49 } from "node:crypto";
|
|
177143
177177
|
import { homedir as homedir8 } from "node:os";
|
|
177144
177178
|
import { dirname as dirname47, join as join54 } from "node:path";
|
|
177145
177179
|
var INHERITED = {
|
|
@@ -177198,6 +177232,17 @@ function withNoProxyArg(entry) {
|
|
|
177198
177232
|
return { ...entry, args: [...entry.args.slice(0, index), "--noproxy=", ...entry.args.slice(index)] };
|
|
177199
177233
|
}
|
|
177200
177234
|
var NPM_ONLINE_ENVIRONMENT = Object.freeze({ npm_config_offline: "false", npm_config_prefer_offline: "false", npm_config_prefer_online: "true" });
|
|
177235
|
+
var TOR_TRY_MS = Object.freeze([12e4, 12e4, 24e4]);
|
|
177236
|
+
var TOR_DOWNLOAD_TRIES = TOR_TRY_MS.length;
|
|
177237
|
+
var ROUTE_ERROR = /\b(FETCH_ERROR|ECONNRESET|ETIMEDOUT|ESOCKETTIMEDOUT|ERR_SOCKET_TIMEOUT|ECONNABORTED|EPIPE|EAI_AGAIN|E502|E503|E504)\b/;
|
|
177238
|
+
var routeFailure = (check) => check?.why === "timeout" || check?.why === "stopped" && ROUTE_ERROR.test(String(check.detail ?? ""));
|
|
177239
|
+
var NPM_ONE_TRY_ENVIRONMENT = Object.freeze({ npm_config_fetch_retries: "0" });
|
|
177240
|
+
function newTorRoute(url) {
|
|
177241
|
+
const next = new URL(url);
|
|
177242
|
+
next.username = "tor";
|
|
177243
|
+
next.password = randomBytes49(16).toString("hex");
|
|
177244
|
+
return next.href.replace(/\/$/, "");
|
|
177245
|
+
}
|
|
177201
177246
|
var NPM_OFFLINE_ENVIRONMENT = Object.freeze({ npm_config_offline: "true" });
|
|
177202
177247
|
var NPM_CACHE_KEYS = /* @__PURE__ */ new Set(["npm_config_cache", "npm_config_userconfig", "npm_config_globalconfig", "npm_config_prefix"]);
|
|
177203
177248
|
var hasOwnNpmCacheSettings = (env = process.env) => Object.entries(env).some(([key, value2]) => value2 !== void 0 && NPM_CACHE_KEYS.has(key.toLowerCase()));
|
|
@@ -177217,7 +177262,7 @@ function appEnvironment(entry, { platform = process.platform, env = process.env,
|
|
|
177217
177262
|
return { ...out, ...entry.env ?? {}, ...extra ?? {} };
|
|
177218
177263
|
}
|
|
177219
177264
|
var nodeMissing = (code2, text3) => code2 === 9009 || code2 === 127 || /is not recognized|command not found|No such file or directory|env: .?node/i.test(text3);
|
|
177220
|
-
function checkHostEntry(entry, { platform = process.platform, env = process.env, terminal = false, path, extraEnv, timeoutMs = HOST_CHECK_TIMEOUT_MS, spawnImpl = spawn12, cwd = homedir8() } = {}) {
|
|
177265
|
+
function checkHostEntry(entry, { platform = process.platform, env = process.env, terminal = false, path, extraEnv, timeoutMs = HOST_CHECK_TIMEOUT_MS, spawnImpl = spawn12, cwd = homedir8(), endAtOnce = false } = {}) {
|
|
177221
177266
|
const started = Date.now();
|
|
177222
177267
|
return new Promise((resolveCheck) => {
|
|
177223
177268
|
let child;
|
|
@@ -177228,6 +177273,10 @@ function checkHostEntry(entry, { platform = process.platform, env = process.env,
|
|
|
177228
177273
|
if (settled) return;
|
|
177229
177274
|
settled = true;
|
|
177230
177275
|
clearTimeout(timer);
|
|
177276
|
+
if (endAtOnce && !outcome.ok) {
|
|
177277
|
+
end(child, platform, { now: true }).then(() => resolveCheck(outcome));
|
|
177278
|
+
return;
|
|
177279
|
+
}
|
|
177231
177280
|
end(child, platform);
|
|
177232
177281
|
resolveCheck(outcome);
|
|
177233
177282
|
};
|
|
@@ -177286,8 +177335,8 @@ var lastLine = (text3) => {
|
|
|
177286
177335
|
if (code2) return code2.slice(0, 200);
|
|
177287
177336
|
return lines.filter((line) => line && !/^(npm (warn|notice)|MCP_|\[)/i.test(line) && !/^npm error A complete log of this run/i.test(line)).at(-1)?.slice(0, 200) ?? "";
|
|
177288
177337
|
};
|
|
177289
|
-
function end(child, platform) {
|
|
177290
|
-
if (!child?.pid) return;
|
|
177338
|
+
function end(child, platform, { now = false } = {}) {
|
|
177339
|
+
if (!child?.pid) return Promise.resolve();
|
|
177291
177340
|
try {
|
|
177292
177341
|
child.stdin.end();
|
|
177293
177342
|
} catch {
|
|
@@ -177305,6 +177354,20 @@ function end(child, platform) {
|
|
|
177305
177354
|
} catch {
|
|
177306
177355
|
}
|
|
177307
177356
|
};
|
|
177357
|
+
if (now) {
|
|
177358
|
+
killTree();
|
|
177359
|
+
return new Promise((resolveEnd) => {
|
|
177360
|
+
if (child.exitCode !== null || child.signalCode !== null) {
|
|
177361
|
+
resolveEnd();
|
|
177362
|
+
return;
|
|
177363
|
+
}
|
|
177364
|
+
const wait2 = setTimeout(resolveEnd, 1e4);
|
|
177365
|
+
child.once("exit", () => {
|
|
177366
|
+
clearTimeout(wait2);
|
|
177367
|
+
resolveEnd();
|
|
177368
|
+
});
|
|
177369
|
+
});
|
|
177370
|
+
}
|
|
177308
177371
|
const kill = setTimeout(killTree, 15e3);
|
|
177309
177372
|
if (platform === "win32") {
|
|
177310
177373
|
kill.unref?.();
|
|
@@ -177319,6 +177382,7 @@ function end(child, platform) {
|
|
|
177319
177382
|
poll = setInterval(gone, 1e3);
|
|
177320
177383
|
gone();
|
|
177321
177384
|
}
|
|
177385
|
+
return Promise.resolve();
|
|
177322
177386
|
}
|
|
177323
177387
|
function groupHoldsOwn(pgid, sinceMs) {
|
|
177324
177388
|
if (!groupAlive(pgid)) return false;
|
|
@@ -177363,7 +177427,9 @@ function hostCheckWords(app, check) {
|
|
|
177363
177427
|
return `${app} was not checked: Tor is on for this wallet and did not answer, so the wallet was not downloaded for ${app} (a download without Tor would show this computer's address). Check the internet connection, then do this step again.`;
|
|
177364
177428
|
}
|
|
177365
177429
|
if (check.why === "node_missing") return `${app} cannot find Node.js, which runs the wallet. Install Node.js from https://nodejs.org (the LTS version), then do this step again.`;
|
|
177430
|
+
if (check.why === "timeout" && check.tries) return `${app} could not download the wallet over Tor: ${check.tries} tries, each on a new Tor route, did not finish in time. Check the internet connection, then do this step again.`;
|
|
177366
177431
|
if (check.why === "timeout") return `${app} could not start the wallet within ${Math.round(HOST_CHECK_TIMEOUT_MS / 6e4)} minutes: the wallet download is slow or blocked on this network. Check the internet connection, then do this step again.`;
|
|
177432
|
+
if (check.tries) return `${app} could not download the wallet over Tor: ${check.tries} tries, each on a new Tor route, failed (${check.detail}). Check the internet connection, then do this step again.`;
|
|
177367
177433
|
return `${app} could not start the wallet (${check.detail}). Do this step again.`;
|
|
177368
177434
|
}
|
|
177369
177435
|
|
|
@@ -178737,11 +178803,13 @@ function setupHeader(paint2, columns = 80, title = "set up the wallet") {
|
|
|
178737
178803
|
return `\x1B[0m\x1B[2J\x1B[H${commandHeader(columns, title)}
|
|
178738
178804
|
`;
|
|
178739
178805
|
}
|
|
178740
|
-
function setupFooter(paint2, columns = 80) {
|
|
178806
|
+
function setupFooter(paint2, columns = 80, { notReady } = {}) {
|
|
178741
178807
|
const width = Math.max(20, Math.min((columns || 80) - 1, 100));
|
|
178808
|
+
const done = notReady ? `${paint2([["\u25C6 ", "crim"], ["setup: wallet made, not ready for an agent app yet", "bone"]])}
|
|
178809
|
+
${paint2([[" ", ""], [notReady, "bone"]])}` : paint2([["\u25C6 ", "crim"], ["setup: done", "bone"]]);
|
|
178742
178810
|
return `
|
|
178743
178811
|
${paint2([["\u2500".repeat(width), "ash"]])}
|
|
178744
|
-
${
|
|
178812
|
+
${done}
|
|
178745
178813
|
${commandFooter(columns)}`;
|
|
178746
178814
|
}
|
|
178747
178815
|
|
|
@@ -179897,7 +179965,7 @@ var wentOut = (kept2) => kept2?.committed === true && kept2.cancelled !== true;
|
|
|
179897
179965
|
function personClaim(values, deps, { key, prefix, what }) {
|
|
179898
179966
|
const home = setupHome(deps.env);
|
|
179899
179967
|
const homeJob = inHomeJob(deps.env);
|
|
179900
|
-
const fresh = () => `${prefix}-${
|
|
179968
|
+
const fresh = () => `${prefix}-${randomBytes52(8).toString("hex")}`;
|
|
179901
179969
|
let claim;
|
|
179902
179970
|
try {
|
|
179903
179971
|
claim = claimLinkPayment(home, key, fresh());
|
|
@@ -179946,7 +180014,7 @@ async function personRun(values, deps, person, run2) {
|
|
|
179946
180014
|
releaseLinkPayment(home, key, { drop: false });
|
|
179947
180015
|
words2 = `${words2.replace(/[.\s]+$/, "")}. The wallet could not read its payment record now, so it keeps this payment: ${again}: it never pays twice`;
|
|
179948
180016
|
} else if (mismatch && !wentOut(read2.kept)) {
|
|
179949
|
-
renewLinkPayment(home, key, requestId, `${requestId.split("-")[0]}-${
|
|
180017
|
+
renewLinkPayment(home, key, requestId, `${requestId.split("-")[0]}-${randomBytes52(8).toString("hex")}`);
|
|
179950
180018
|
releaseLinkPayment(home, key, { drop: false });
|
|
179951
180019
|
words2 = coded(`the wallet held an earlier payment for this ${what} that was made in another way and never went out, so nothing was paid now. ${again[0].toUpperCase()}${again.slice(1)}: it makes a new payment`);
|
|
179952
180020
|
} else if (mismatch) {
|
|
@@ -179977,14 +180045,14 @@ async function runCurlRequest(values, deps) {
|
|
|
179977
180045
|
throw new UsageError("curl is missing --max-payment <usdc>: the most this request may pay, in USDC (0.02 = 2 cents); in a terminal, curl shows the seller's price and asks instead", COMMAND_BY_NAME.get("curl"));
|
|
179978
180046
|
}
|
|
179979
180047
|
const io = deps.io;
|
|
179980
|
-
const requestId = values.get("--request-id") ?? values.get(LINK_REQUEST_ID) ?? `curl-${
|
|
180048
|
+
const requestId = values.get("--request-id") ?? values.get(LINK_REQUEST_ID) ?? `curl-${randomBytes52(8).toString("hex")}`;
|
|
179981
180049
|
let kept2;
|
|
179982
180050
|
if (values.has("--request-id")) {
|
|
179983
180051
|
const { walletPath: walletPath2, passphrase: passphrase2 } = payerSessionOptions(values, deps);
|
|
179984
180052
|
kept2 = keptPayment((deps.openWalletStore ?? openWalletStore)(walletPath2, passphrase2), requestId);
|
|
179985
180053
|
if (kept2?.committed) kept2 = void 0;
|
|
179986
180054
|
}
|
|
179987
|
-
const probeId = kept2 ? `curl-${
|
|
180055
|
+
const probeId = kept2 ? `curl-${randomBytes52(8).toString("hex")}` : requestId;
|
|
179988
180056
|
const probe = createSpendPolicy({ maxPaymentAtomic: NO_LIMIT_ATOMIC, allowHosts: ["price-probe.invalid"] });
|
|
179989
180057
|
const body = curlBody(values);
|
|
179990
180058
|
const method = (values.get("--method") ?? (body === void 0 ? "GET" : "POST")).toUpperCase();
|
|
@@ -180038,7 +180106,7 @@ async function runCurlPaid(values, deps, { requestId: probeId } = {}) {
|
|
|
180038
180106
|
const method = (values.get("--method") ?? (body === void 0 ? "GET" : "POST")).toUpperCase();
|
|
180039
180107
|
const headers = (values.get("--header") ?? []).map((line) => [line.slice(0, line.indexOf(":")).trim(), line.slice(line.indexOf(":") + 1).trim()]);
|
|
180040
180108
|
const given = values.get("--request-id");
|
|
180041
|
-
const requestId = given ?? probeId ?? values.get(LINK_REQUEST_ID) ?? `curl-${
|
|
180109
|
+
const requestId = given ?? probeId ?? values.get(LINK_REQUEST_ID) ?? `curl-${randomBytes52(8).toString("hex")}`;
|
|
180042
180110
|
const person = values.get(PERSON_LINK);
|
|
180043
180111
|
const session = await (deps.openPayerSession ?? openPayerSession)({ ...payerSessionOptions(values, deps), spendPolicy: policy });
|
|
180044
180112
|
let response;
|
|
@@ -180712,7 +180780,7 @@ async function runInfer(values, deps) {
|
|
|
180712
180780
|
...terminalDayLimit(values, deps)
|
|
180713
180781
|
});
|
|
180714
180782
|
const given = values.get("--request-id");
|
|
180715
|
-
const requestId = given ?? `infer-${
|
|
180783
|
+
const requestId = given ?? `infer-${randomBytes52(8).toString("hex")}`;
|
|
180716
180784
|
const session = await (deps.openPayerSession ?? openPayerSession)({ ...payerSessionOptions(values, deps), spendPolicy: policy });
|
|
180717
180785
|
const stopWatch = quiet && !given ? idLineOnInterrupt(io, inferStopLine(requestId, values, deps)) : () => {
|
|
180718
180786
|
};
|
|
@@ -182057,7 +182125,7 @@ function mcpTorAheadHome(values, deps) {
|
|
|
182057
182125
|
return firstRun && configOrNull(firstRun.home)?.tor === true ? firstRun.home : void 0;
|
|
182058
182126
|
}
|
|
182059
182127
|
async function torRunOf(args, deps, err) {
|
|
182060
|
-
const startedFile = join60(tmpdir8(), `shinjuku-wallet-tor-run-${
|
|
182128
|
+
const startedFile = join60(tmpdir8(), `shinjuku-wallet-tor-run-${randomBytes52(16).toString("hex")}`);
|
|
182061
182129
|
try {
|
|
182062
182130
|
const code2 = await deps.torReexec(args, { startedFile, err });
|
|
182063
182131
|
return { code: code2, started: existsSync(startedFile) };
|
|
@@ -183069,7 +183137,7 @@ async function runRestoreCommand(values, deps) {
|
|
|
183069
183137
|
if (!restored) {
|
|
183070
183138
|
mkdirSync(home, { recursive: true, mode: 448 });
|
|
183071
183139
|
const ownFile = join60(home, PASSPHRASE_FILE);
|
|
183072
|
-
if (!existsSync(ownFile)) writeRecoveryFile(ownFile,
|
|
183140
|
+
if (!existsSync(ownFile)) writeRecoveryFile(ownFile, randomBytes52(32).toString("base64url"));
|
|
183073
183141
|
await deps.setupInit({ home, passphrase: readSecretText(ownFile, "the passphrase file"), args: [
|
|
183074
183142
|
"restore",
|
|
183075
183143
|
"--pool",
|
|
@@ -183340,8 +183408,24 @@ function hostStartCheck(app, options, deps, { terminal, noTor = false, cwd, intr
|
|
|
183340
183408
|
`);
|
|
183341
183409
|
const start = async (entry) => {
|
|
183342
183410
|
if (!net5.url) return check(entry, { platform, env, terminal, extraEnv: { ...outerProxyEnv(env), ...NPM_ONLINE_ENVIRONMENT }, ...at });
|
|
183343
|
-
|
|
183344
|
-
|
|
183411
|
+
let filled;
|
|
183412
|
+
let tries = 0;
|
|
183413
|
+
for (const timeoutMs of TOR_TRY_MS) {
|
|
183414
|
+
if (tries > 0) deps.io.out(`The download over Tor did not finish; trying again on a new Tor route (try ${tries + 1} of ${TOR_DOWNLOAD_TRIES})...
|
|
183415
|
+
`);
|
|
183416
|
+
tries += 1;
|
|
183417
|
+
filled = await check(withNoProxyArg(entry), {
|
|
183418
|
+
platform,
|
|
183419
|
+
env,
|
|
183420
|
+
terminal,
|
|
183421
|
+
timeoutMs,
|
|
183422
|
+
endAtOnce: true,
|
|
183423
|
+
extraEnv: { ...npmProxyEnvironment(newTorRoute(net5.url)), ...NPM_ONE_TRY_ENVIRONMENT },
|
|
183424
|
+
...at
|
|
183425
|
+
});
|
|
183426
|
+
if (filled.ok || !routeFailure(filled)) break;
|
|
183427
|
+
}
|
|
183428
|
+
if (!filled.ok) return routeFailure(filled) ? { ...filled, tries } : filled;
|
|
183345
183429
|
return check(entry, { platform, env, terminal, extraEnv: NPM_OFFLINE_ENVIRONMENT, ...at });
|
|
183346
183430
|
};
|
|
183347
183431
|
const first = await start(mcpServerEntry(options));
|
|
@@ -183354,6 +183438,7 @@ function hostStartCheck(app, options, deps, { terminal, noTor = false, cwd, intr
|
|
|
183354
183438
|
return hostChecks.get(key);
|
|
183355
183439
|
}
|
|
183356
183440
|
async function fillStartCache(home, deps, { npmVersion, noTor = false, added }) {
|
|
183441
|
+
startCopyMissing = false;
|
|
183357
183442
|
if (added?.size || !npxPackageWord(npmVersion).includes("@")) return;
|
|
183358
183443
|
const options = { home, env: deps.env, platform: deps.platform ?? process.platform, npmVersion };
|
|
183359
183444
|
let overTor = false;
|
|
@@ -183367,9 +183452,13 @@ async function fillStartCache(home, deps, { npmVersion, noTor = false, added })
|
|
|
183367
183452
|
}
|
|
183368
183453
|
});
|
|
183369
183454
|
if (check.ok) return;
|
|
183370
|
-
|
|
183455
|
+
startCopyMissing = true;
|
|
183456
|
+
const why = check.tries ? `its download over Tor ${check.why === "timeout" ? "did not finish in time" : `failed (${check.detail})`} after ${check.tries} tries, each on a new Tor route.` : `${hostCheckWords("This computer", check)}${overTor ? " (The download goes only through Tor, never without it.)" : ""}`;
|
|
183457
|
+
deps.io.out(`Your wallet is made, but an agent app cannot start it yet: ${why} ${START_COPY_FIX} That downloads the wallet again.
|
|
183371
183458
|
`);
|
|
183372
183459
|
}
|
|
183460
|
+
var startCopyMissing = false;
|
|
183461
|
+
var START_COPY_FIX = "To fix it, open Shinjuku and press c (connect an agent app).";
|
|
183373
183462
|
async function hostCheckProxy(home, deps, noTor) {
|
|
183374
183463
|
let config;
|
|
183375
183464
|
try {
|
|
@@ -184197,6 +184286,7 @@ async function runSetupCommandHeld(values, deps) {
|
|
|
184197
184286
|
deps,
|
|
184198
184287
|
{ force: values.has("--force"), npmVersion, ask: interactive && deps.stdinIsTTY() ? deps.ask : void 0, noTor: values.has("--no-tor") }
|
|
184199
184288
|
) : void 0;
|
|
184289
|
+
if (hosts2?.cacheFilled?.size) startCopyMissing = false;
|
|
184200
184290
|
const added2 = /* @__PURE__ */ new Set([...hosts2?.added ?? [], ...hosts2?.kept ?? []]);
|
|
184201
184291
|
if (readsBack) readEmpty();
|
|
184202
184292
|
else if (addsAppOnly(values, targets)) io.out(addAppOnlyText(targets, new Set(hosts2?.added ?? [])));
|
|
@@ -186551,7 +186641,7 @@ async function runWalletSend(values, deps, io) {
|
|
|
186551
186641
|
const policy = createSpendPolicy({ maxPaymentAtomic: limits?.maxPaymentAtomic ?? amountAtomic, ...terminalDayLimit(values, deps) });
|
|
186552
186642
|
const profile = JSON.parse(readFileSync(resolve44(values.get("--profile")), "utf8"));
|
|
186553
186643
|
const given = values.get("--unshield-id");
|
|
186554
|
-
const requestId = given ?? `send-${
|
|
186644
|
+
const requestId = given ?? `send-${randomBytes52(8).toString("hex")}`;
|
|
186555
186645
|
if (!given) io.err(deps.stdoutIsTTY?.() === true && !values.has("--json") ? "If this stops before it says Paid or Sent, ask for your balance before you send again: a send that went out shows there.\n" : `unshield id ${requestId} (if this run stops, run the same command with --unshield-id ${requestId} added: it never sends twice)
|
|
186556
186646
|
`);
|
|
186557
186647
|
const session = await (deps.openPayerSession ?? openPayerSession)({
|
|
@@ -186751,7 +186841,7 @@ async function runUnshieldRequest(args, values, deps, io) {
|
|
|
186751
186841
|
};
|
|
186752
186842
|
const ensureId = () => {
|
|
186753
186843
|
if (id !== void 0) return;
|
|
186754
|
-
id = `unshield-${
|
|
186844
|
+
id = `unshield-${randomBytes52(6).toString("hex")}`;
|
|
186755
186845
|
setArg("--unshield-id", id);
|
|
186756
186846
|
values.set(UNSHIELD_MADE_ID, id);
|
|
186757
186847
|
if (quiet) {
|
|
@@ -187460,7 +187550,7 @@ async function runPayMe(values, deps, io) {
|
|
|
187460
187550
|
} catch {
|
|
187461
187551
|
receiveShielded = void 0;
|
|
187462
187552
|
}
|
|
187463
|
-
const linkId = id ?? `link-${
|
|
187553
|
+
const linkId = id ?? `link-${randomBytes52(6).toString("hex")}`;
|
|
187464
187554
|
const record = await createPayMe({ store, connection, id: linkId, amountAtomic, note: values.get("--note"), ...receiveShielded ? { receiveShielded } : {} });
|
|
187465
187555
|
const view2 = payMeView(record);
|
|
187466
187556
|
if (!terminal) {
|
|
@@ -188187,7 +188277,7 @@ async function runShieldCommand(values, deps, io) {
|
|
|
188187
188277
|
`you did not type y, so nothing was moved. To make it private, ${again}`
|
|
188188
188278
|
);
|
|
188189
188279
|
}
|
|
188190
|
-
depositId = `shield-${
|
|
188280
|
+
depositId = `shield-${randomBytes52(8).toString("hex")}`;
|
|
188191
188281
|
}
|
|
188192
188282
|
writePendingShield(store, depositId, amountAtomic, new Date(deps.now()).toISOString());
|
|
188193
188283
|
try {
|
|
@@ -190094,7 +190184,7 @@ function setupThemeFor(values, deps) {
|
|
|
190094
190184
|
}
|
|
190095
190185
|
async function openShinjukuAfterSetup(argv2, deps, theme2) {
|
|
190096
190186
|
delete deps.env[SETUP_THEME_ENV];
|
|
190097
|
-
deps.io.out(setupFooter(theme2.paint, process.stdout.columns));
|
|
190187
|
+
deps.io.out(setupFooter(theme2.paint, process.stdout.columns, startCopyMissing ? { notReady: START_COPY_FIX } : void 0));
|
|
190098
190188
|
let answer;
|
|
190099
190189
|
try {
|
|
190100
190190
|
answer = String(await theme2.ask("Open Shinjuku now? (Enter = yes) ")).trim();
|