shinjuku-shield 0.3.251 → 0.3.253
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 +204 -90
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.253. 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.253 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.253, 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": "0593a1731586d3389be05986bbeb6c5c9168ae0cea661417e7db211fb1d3ac82",
|
|
5
|
+
"bytes": 10871936,
|
|
6
|
+
"sourceCommit": "6b916a0b1ceb40af662c2cfe445b22cfb8a843cd",
|
|
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:48:55.451Z"
|
|
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.253",
|
|
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": "0593a173",
|
|
7
|
+
"shinjukuSha256": "0593a1731586d3389be05986bbeb6c5c9168ae0cea661417e7db211fb1d3ac82",
|
|
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);
|
|
@@ -148986,29 +149028,50 @@ ${key}`).digest("hex").slice(0, 40)}.json`);
|
|
|
148986
149028
|
log(`MCP_TOR_ON config.json records Tor${step?.recorded ? "" : " (no record answer)"}; the app's next start runs behind Tor`);
|
|
148987
149029
|
return torRestartAnswer();
|
|
148988
149030
|
}
|
|
149031
|
+
let torAsk;
|
|
149032
|
+
let torAnswered;
|
|
149033
|
+
const torDeclinedAnswer = (what) => json4({
|
|
149034
|
+
ok: false,
|
|
149035
|
+
error: "tor_declined",
|
|
149036
|
+
detail: "the user kept Tor off in the wallet's question; nothing was paid and nothing changed",
|
|
149037
|
+
next: `Tell the user, in these words: "${what} needs Tor; you chose not to turn it on. Nothing was paid. Turn Tor on to use it." Do not call this tool again for it; if the user then asks to turn Tor on, call wallet_tor`,
|
|
149038
|
+
say: `${what} needs Tor; you chose not to turn it on. Nothing was paid. Turn Tor on to use it.`
|
|
149039
|
+
});
|
|
149040
|
+
const torWaitingAnswer = (what) => json4({
|
|
149041
|
+
ok: false,
|
|
149042
|
+
error: "tor_question_open",
|
|
149043
|
+
detail: "the wallet's Tor question is still open on the user's screen; nothing was paid and nothing changed",
|
|
149044
|
+
next: "Tell the user to answer the wallet's question about Tor on their screen. Do not call this tool again until the user says they answered it",
|
|
149045
|
+
say: `${what} needs Tor. The question about Tor is waiting on your screen; answer it, then ask me again. Nothing was paid.`
|
|
149046
|
+
});
|
|
149047
|
+
function torQuestion(what, selfCounted) {
|
|
149048
|
+
torAsk ??= (async () => {
|
|
149049
|
+
const box = await confirmOnce({
|
|
149050
|
+
message: `${what} needs Tor, which hides your IP address. Turn Tor on?`,
|
|
149051
|
+
detail: "Tor hides your IP address from Shinjuku, the AI provider and sellers. The wallet turns it on; then quit this app fully and open it again.",
|
|
149052
|
+
waitMs: elicitTimeoutMs,
|
|
149053
|
+
strict: true,
|
|
149054
|
+
title: "Turn Tor on",
|
|
149055
|
+
checked: true
|
|
149056
|
+
});
|
|
149057
|
+
const output2 = box.ok ? await torOnNow({ selfCounted }) : ["declined", "closed", "not_ticked"].includes(box.why) ? torDeclinedAnswer(what) : void 0;
|
|
149058
|
+
torAnswered = { at: Date.now(), output: output2 };
|
|
149059
|
+
return output2;
|
|
149060
|
+
})().finally(() => {
|
|
149061
|
+
torAsk = void 0;
|
|
149062
|
+
});
|
|
149063
|
+
return torAsk;
|
|
149064
|
+
}
|
|
149065
|
+
const torQuestionOpen = () => torAsk !== void 0;
|
|
148989
149066
|
async function torBox(what, ctx = {}, { selfCounted = false } = {}) {
|
|
148990
149067
|
if (inTorRun() || typeof turnTorOn !== "function") return void 0;
|
|
148991
149068
|
if (torRecordedHere) return torRestartAnswer();
|
|
148992
149069
|
if (client?.canElicit?.() !== true) return void 0;
|
|
148993
|
-
|
|
148994
|
-
|
|
148995
|
-
|
|
148996
|
-
|
|
148997
|
-
|
|
148998
|
-
strict: true,
|
|
148999
|
-
title: "Turn Tor on",
|
|
149000
|
-
checked: true
|
|
149001
|
-
});
|
|
149002
|
-
if (box.ok) return torOnNow({ selfCounted });
|
|
149003
|
-
if (!["declined", "closed", "not_ticked"].includes(box.why)) return void 0;
|
|
149004
|
-
const off = `${what[0].toLowerCase()}${what.slice(1)}`;
|
|
149005
|
-
return json4({
|
|
149006
|
-
ok: false,
|
|
149007
|
-
error: "tor_declined",
|
|
149008
|
-
detail: "the user kept Tor off in the wallet's question; nothing changed",
|
|
149009
|
-
next: `Tell the user Tor stays off, so ${off} stays unavailable. Do not ask about Tor again unless the user asks`,
|
|
149010
|
-
say: `Tor stays off, so ${off} stays unavailable. Nothing changed.`
|
|
149011
|
-
});
|
|
149070
|
+
if (!torAsk && torAnswered?.output !== void 0 && Date.now() - torAnswered.at < TOR_ANSWER_KEEP_MS) return torAnswered.output;
|
|
149071
|
+
const asking = torQuestion(what, selfCounted);
|
|
149072
|
+
const waited = await Promise.race([asking.then((output2) => ({ output: output2 })), sleep2(TOR_WAIT_IN_CALL_MS).then(() => void 0)]);
|
|
149073
|
+
if (waited === void 0) return torWaitingAnswer(what);
|
|
149074
|
+
return waited.output;
|
|
149012
149075
|
}
|
|
149013
149076
|
const progressEveryMs = Number.isSafeInteger(ops.progressEveryMs) && ops.progressEveryMs > 0 ? ops.progressEveryMs : PROGRESS_EVERY_MS2;
|
|
149014
149077
|
const statusWait = (promises, ms, progress2, message) => waitOrProgress(promises, ms, { progress: progress2, message, everyMs: progressEveryMs });
|
|
@@ -149761,7 +149824,7 @@ ${key}`).digest("hex").slice(0, 40)}.json`);
|
|
|
149761
149824
|
const withPoolSwitch = (tool) => ({ ...tool, run: async (...args) => {
|
|
149762
149825
|
let output2;
|
|
149763
149826
|
const paying = tool.name === "pay_for_service";
|
|
149764
|
-
const moving = tool.annotations?.readOnlyHint !== true;
|
|
149827
|
+
const moving = tool.annotations?.readOnlyHint !== true || MOVES_WHILE_READING.has(tool.name);
|
|
149765
149828
|
const spending = SPEND_TOOLS.has(tool.name);
|
|
149766
149829
|
callsInFlight += 1;
|
|
149767
149830
|
if (spending) spendCallsInFlight += 1;
|
|
@@ -152323,7 +152386,7 @@ ${canonical6}`;
|
|
|
152323
152386
|
const prefixes = [FLOAT_PAYMENT_WAL_PREFIX2, RESOURCE_PAYMENT_WAL_PREFIX2, POCKET_PAYMENT_WAL_PREFIX];
|
|
152324
152387
|
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
152388
|
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);
|
|
152389
|
+
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
152390
|
if (take >= timed.length) return rows2;
|
|
152328
152391
|
const nextMs = timed[take].ms;
|
|
152329
152392
|
if (rows2.length === count3 && nextMs >= 0 && nextMs + 2e3 < rows2[count3 - 1].at) return rows2;
|
|
@@ -159224,7 +159287,11 @@ ${canonical6}`;
|
|
|
159224
159287
|
},
|
|
159225
159288
|
additionalProperties: false
|
|
159226
159289
|
},
|
|
159227
|
-
|
|
159290
|
+
// readOnlyHint true (row 23 on 0.3.251, Hermes: a status read asked for approval, a second box for one link): it
|
|
159291
|
+
// reads, and shields USDC that reached the user's own link into the user's own private balance, as wallet_balance
|
|
159292
|
+
// does (also readOnlyHint true); "close" moves nothing. The wallet still counts its calls as money moves
|
|
159293
|
+
// (MOVES_WHILE_READING). Session-made, 2026-11-19 (its commit names it).
|
|
159294
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
159228
159295
|
async run(args, { progress: progress2 } = {}) {
|
|
159229
159296
|
const startedAt = Date.now();
|
|
159230
159297
|
const given = args?.request_id;
|
|
@@ -160381,21 +160448,6 @@ ${canonical6}`;
|
|
|
160381
160448
|
}, "inference_chat")), paidStore);
|
|
160382
160449
|
}
|
|
160383
160450
|
};
|
|
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
160451
|
const listedModelNames = /* @__PURE__ */ new Map();
|
|
160400
160452
|
function chatModelName(id) {
|
|
160401
160453
|
if (listedModelNames.has(id)) return listedModelNames.get(id);
|
|
@@ -160690,6 +160742,7 @@ ${JSON.stringify(args ?? {})}`;
|
|
|
160690
160742
|
}
|
|
160691
160743
|
const read2 = await waitOrProgress([running], readBudgetMs);
|
|
160692
160744
|
if (read2 !== void 0) return read2;
|
|
160745
|
+
if (torQuestionOpen()) return running;
|
|
160693
160746
|
running.catch(() => {
|
|
160694
160747
|
});
|
|
160695
160748
|
log(`MCP_READ_BUDGET_PASSED tool=${tool.name}`);
|
|
@@ -161922,7 +161975,7 @@ function createSetupTools({
|
|
|
161922
161975
|
finalPending
|
|
161923
161976
|
};
|
|
161924
161977
|
}
|
|
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;
|
|
161978
|
+
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, TOR_WAIT_IN_CALL_MS, TOR_ANSWER_KEEP_MS, UNPAID_TOR_TRY_MS, UNPAID_TOR_OPEN_MS, UNPAID_CLEAR_MS, READ_BUDGET_TOOLS, FLOAT_BUSY_CODES, RETRY_MARGIN_MS, ASK_PAY_CODES, runningNpmVersion2, terminalCommand2, capPlaceWords, noLimitSetLine, CAP_NAMES, capName, entryPlaces, capRaiseText, runningLimits, payCapFlag, noPriceFits, cheaperText, limitNext, overLimitStep, logCause, SAFE_TEXT, causesLog, ADD_FUNDS_DONE_SHOWN_MS, addFundsShownName, MCP_TOOL_ALIASES, POOL_SWITCH_WHY, POOL_SWITCH_NEXT, SWITCH_STATES, quietSwitch, switchKey, ATOMIC_TEXT, MAX_PAYMENT_ATOMIC_LEAST, movedTo, FLOAT_ID2, ANSWERED_EXIT_RETRY_MS, ANSWERED_EXIT_UNCONFIRMED_MS, ANSWERED_EXIT_RETRY_WINDOW_MS, ANSWERED_EXIT_CLOSED, switchAmount, switchEta, switchRows, OWNER_CAP_CODES, JOIN_END_MCP, JOIN_END_TERMINAL_LIBRARY, JOIN_RETRY_BACKOFF_MS, WALLET_CAP_FIX, ENTRY_CAP_CODES, MCP_CAP_FIX, capFix, ownerOnlyNext, mcpNext, CONFIDENTIAL_RETIRED, json4, answerResult, discoverTool, LAUNCH_CAP_CODES, dayCapKind, refuse11, newRequestIdFor, payCapName, limitQuestion, stableJson, requestPrint, JSON_SNIFF_MAX_CHARS, publicOffer, FLOAT_PAID_CODES, FLOAT_NOT_CERTAIN_CODES, FLOAT_PRIVATE_LEG, SELLER_ONLY_HERE, outsideWalletRule, TOR_START_STEP, MONEY_ID2, toRecordId, linkKindOf, moneyId, FUNDING_REFUSAL_SCHEMA, fundingRefusalName, OTHER_WALLET_NEXT, REFUSED_CODES, SEND_STOPPED, SEND_STOP_NOT_SAVED, sendStoppedError, refusedCodeOf, PLAIN_REASONS, insufficientCause, INSUFFICIENT_REASONS, historyRefusalCode, reasonOf, plainReason, KEPT_SEND_TRIES, shownId, isSplitSend, PROMISED_NEXT, partFailReason, sendAnswerOf, PUBLIC_READ_TIMEOUT_MS, RECIPIENT_CHECK_TIMEOUT_MS, withTimeout, ownKey, readFailure, OWN_KEY_TOKENS_MAX, tokenAmountText, elsewhereId, PORTAL_DEPOSIT_ID, PORTAL_BLOCK_WORDS, isPortalBlocker, TERMINAL_PLAN_PREFIX, APP_LINK_PREFIX, cliPlanSplit, blockedByOf, AGENT_ID_SCHEMA, agentIdName, minutesText2, ageWords2, agoWords, DEPOSIT_SENT_STATES, depositLanded, usdcText3, walkWalletHistory, REFRESH_LEASE_WALK_MS, HOME_MARKS_SETTLED_MS2, AUTO_BACKUPS_KEPT, AUTO_BACKUP_NAME, AUTO_BACKUP_VERIFIED, FRONTED_SETTLE_MARGIN_SLOTS, RECIPIENT_READ_TOTAL_MS, RECIPIENT_READ_SLOW_MS, slowReadSaid, UNSHIELD_WINDOW_YIELD_MS, NOT_FINAL_YET, FINISH_FINALITY_WAIT_MS, FINISH_FINALITY_WAITS, FINISH_FINALITY_RECENT_MS, walkStillCurrent, DIRECT_EXIT_GONE, BALANCE_REFRESH_WAIT_MS, BALANCE_REFRESH_GRACE_MS, BALANCE_REFRESH_LONG_MS, INBOUND_REFRESH_AGE_MS, PAY_ME_STATUS_WALK_MS, REFUND_CHECK_MIN_MS, SALE_VIEW_AGE_SECONDS, saleViewRead, balanceTextFields, changeFields, balanceAnswer, REFRESH_RETRY_MS, FINALITY_POLL_MS, FINALITY_WAIT_MS, FINALITY_REFRESH_LIMIT_MS, FINALITY_CLOSE_WAIT_MS, POOL_WATCH_MS, POOL_WATCH_POLL_MS, EARLY_BALANCE_DELAY_MS, FINALITY_SETTLE_WINDOW_SLOTS, PUBLIC_READ_ANSWER_MS, OWN_READ_ANSWER_MS, RECEIPTS_ID_LOOKUP_MS, RECEIPTS_SEND_WAIT_MS, PRIVATE_ID_NOT_READ, LINK_READ_ANSWER_MS, OWN_READS_AHEAD_MS, OWN_PUBLIC_KNOWN_MS, OWN_READS_REUSE_MS, FLOAT_CORRECT_WAIT_MS, SWITCH_WAIT_MS, UNSHIELD_TO_NO_USDC_DETAIL, UNSHIELD_TO_INVALID_NEXT, ELICIT_TIMEOUT_MS, ALLOW_BOX_HOSTS, ALLOW_BOX_PROGRESS_MS, ELICIT_UNSHOWN_MS, elicitUnshown, ANSWER_ARRIVED_AT, monotonicNow, answerTimeOf, elicitTooFast, POLL_SECONDS2, TEMP_CLEAN_DELAY_MS, KEPT_ON_DISK, receiveGenerator, MCP_TOOL_NAMES, MCP_HIDDEN_TOOL_NAMES, setupTerminalNext, SETUP_RUNNING_SAY, SETUP_WAITING_SAY, ACCEPTED_NEXT, SETUP_RUNNING_NEXT, SETUP_ANSWER_WAIT_MS, SETUP_CONFIRMING_SAY, SETUP_CONFIRMING_NEXT, OWN_ADDRESS_QUESTION, OWN_ADDRESS_WHERE, OWN_ADDRESS_INVALID, hostSeesAnswer, HOST_CHAT_NOT_PRIVATE, PRIVATE_INFERENCE_WHY, RESTART_STEPS, HOST_BLOCKED_LINE, TOR_BROWSER_PORT, SETUP_TOR_TITLE, SETUP_TOR_WHY;
|
|
161926
161979
|
var init_tools = __esm({
|
|
161927
161980
|
"wallet/src/mcp/tools.mjs"() {
|
|
161928
161981
|
"use strict";
|
|
@@ -161940,6 +161993,7 @@ var init_tools = __esm({
|
|
|
161940
161993
|
init_models();
|
|
161941
161994
|
init_inference();
|
|
161942
161995
|
init_liveModels();
|
|
161996
|
+
init_modelNames();
|
|
161943
161997
|
init_balance();
|
|
161944
161998
|
init_book2();
|
|
161945
161999
|
init_client2();
|
|
@@ -162115,6 +162169,7 @@ var init_tools = __esm({
|
|
|
162115
162169
|
JOIN_TIME_MS = Object.freeze({ joinLikely: 22e3, joinMost: 4e4, sendLikely: 35e3, sendMost: 5e4 });
|
|
162116
162170
|
JOIN_NUDGE_QUIET_MS = 15e3;
|
|
162117
162171
|
SPEND_TOOLS = /* @__PURE__ */ new Set(["pay_for_service", "inference_chat", "wallet_unshield"]);
|
|
162172
|
+
MOVES_WHILE_READING = /* @__PURE__ */ new Set(["wallet_pay_me_status"]);
|
|
162118
162173
|
USER_ACTION_TOOLS = /* @__PURE__ */ new Set(["pay_for_service", "wallet_balance", "wallet_add_funds", "wallet_shield", "wallet_unshield"]);
|
|
162119
162174
|
JOIN_STEP_MS = 1e4;
|
|
162120
162175
|
sleep2 = (ms) => new Promise((resolve46) => {
|
|
@@ -162123,6 +162178,8 @@ var init_tools = __esm({
|
|
|
162123
162178
|
});
|
|
162124
162179
|
PROGRESS_EVERY_MS2 = 1e4;
|
|
162125
162180
|
READ_BUDGET_MS = 3e4;
|
|
162181
|
+
TOR_WAIT_IN_CALL_MS = 45e3;
|
|
162182
|
+
TOR_ANSWER_KEEP_MS = 12e4;
|
|
162126
162183
|
UNPAID_TOR_TRY_MS = 12e3;
|
|
162127
162184
|
UNPAID_TOR_OPEN_MS = 8e3;
|
|
162128
162185
|
UNPAID_CLEAR_MS = 25e3;
|
|
@@ -171658,7 +171715,7 @@ var init_torMissingMcp = __esm({
|
|
|
171658
171715
|
|
|
171659
171716
|
// wallet/src/seller/setup.mjs
|
|
171660
171717
|
import http2 from "node:http";
|
|
171661
|
-
import { createHash as createHash50, randomBytes as
|
|
171718
|
+
import { createHash as createHash50, randomBytes as randomBytes50 } from "node:crypto";
|
|
171662
171719
|
import { spawnSync as spawnSync14 } from "node:child_process";
|
|
171663
171720
|
import { join as join55, resolve as resolve41 } from "node:path";
|
|
171664
171721
|
function separateSellerHome(env, userHome) {
|
|
@@ -171756,7 +171813,7 @@ Or run ${cli2()} seller setup again and choose no Tor.`
|
|
|
171756
171813
|
}
|
|
171757
171814
|
const tagged = new URL(tunnel);
|
|
171758
171815
|
tagged.username = "tor";
|
|
171759
|
-
tagged.password =
|
|
171816
|
+
tagged.password = randomBytes50(16).toString("hex");
|
|
171760
171817
|
const dispatcher = proxyDispatcher(proxyDispatcherClass(), tagged.href.replace(/\/$/, ""));
|
|
171761
171818
|
return {
|
|
171762
171819
|
fetch: (input, init = {}) => fetch(input, { ...init, dispatcher }),
|
|
@@ -171859,7 +171916,7 @@ function orphanRefusal(folder) {
|
|
|
171859
171916
|
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
171917
|
}
|
|
171861
171918
|
function writePrivate(path, text3) {
|
|
171862
|
-
const temp = `${path}.${
|
|
171919
|
+
const temp = `${path}.${randomBytes50(4).toString("hex")}.tmp`;
|
|
171863
171920
|
try {
|
|
171864
171921
|
writeRecoveryFile(temp, text3);
|
|
171865
171922
|
renameSync(temp, path);
|
|
@@ -172548,7 +172605,7 @@ var init_setup = __esm({
|
|
|
172548
172605
|
});
|
|
172549
172606
|
|
|
172550
172607
|
// wallet/src/seller/runner.mjs
|
|
172551
|
-
import { randomBytes as
|
|
172608
|
+
import { randomBytes as randomBytes51 } from "node:crypto";
|
|
172552
172609
|
import { spawnSync as spawnSync15 } from "node:child_process";
|
|
172553
172610
|
import { hostname as hostname3 } from "node:os";
|
|
172554
172611
|
import { dirname as dirname48, join as join56 } from "node:path";
|
|
@@ -172558,7 +172615,7 @@ function paidRequestWaitMs(config) {
|
|
|
172558
172615
|
}
|
|
172559
172616
|
function writeAtomic6(path, text3) {
|
|
172560
172617
|
mkdirSync(dirname48(path), { recursive: true, mode: 448 });
|
|
172561
|
-
const temp = `${path}.${
|
|
172618
|
+
const temp = `${path}.${randomBytes51(4).toString("hex")}.tmp`;
|
|
172562
172619
|
writeFileSync(temp, text3, { mode: 384, flag: "wx" });
|
|
172563
172620
|
try {
|
|
172564
172621
|
renameSync(temp, path);
|
|
@@ -172809,7 +172866,7 @@ async function startSellerInBackground({
|
|
|
172809
172866
|
rmSync(sellerStopPath(home), { force: true });
|
|
172810
172867
|
} catch {
|
|
172811
172868
|
}
|
|
172812
|
-
const launchId =
|
|
172869
|
+
const launchId = randomBytes51(16).toString("hex");
|
|
172813
172870
|
const childEnv = childRunProxy(env).env;
|
|
172814
172871
|
for (const name of Object.keys(childEnv)) {
|
|
172815
172872
|
if (ENV_DROP.includes(name) || ENV_DROP_PREFIX.some((prefix) => name.startsWith(prefix))) delete childEnv[name];
|
|
@@ -173623,7 +173680,7 @@ init_emptyBalance();
|
|
|
173623
173680
|
init_knownZero();
|
|
173624
173681
|
init_publicRead();
|
|
173625
173682
|
init_timing();
|
|
173626
|
-
import { randomBytes as
|
|
173683
|
+
import { randomBytes as randomBytes52 } from "node:crypto";
|
|
173627
173684
|
import { dirname as dirname49, join as join60, resolve as resolve44 } from "node:path";
|
|
173628
173685
|
import { spawn as spawn13 } from "node:child_process";
|
|
173629
173686
|
import { fileURLToPath as fileURLToPath24 } from "node:url";
|
|
@@ -177140,6 +177197,7 @@ init_backup();
|
|
|
177140
177197
|
// wallet/src/setup/hostCheck.mjs
|
|
177141
177198
|
init_fs();
|
|
177142
177199
|
import { spawn as spawn12, spawnSync as spawnSync13 } from "node:child_process";
|
|
177200
|
+
import { randomBytes as randomBytes49 } from "node:crypto";
|
|
177143
177201
|
import { homedir as homedir8 } from "node:os";
|
|
177144
177202
|
import { dirname as dirname47, join as join54 } from "node:path";
|
|
177145
177203
|
var INHERITED = {
|
|
@@ -177198,6 +177256,17 @@ function withNoProxyArg(entry) {
|
|
|
177198
177256
|
return { ...entry, args: [...entry.args.slice(0, index), "--noproxy=", ...entry.args.slice(index)] };
|
|
177199
177257
|
}
|
|
177200
177258
|
var NPM_ONLINE_ENVIRONMENT = Object.freeze({ npm_config_offline: "false", npm_config_prefer_offline: "false", npm_config_prefer_online: "true" });
|
|
177259
|
+
var TOR_TRY_MS = Object.freeze([12e4, 12e4, 24e4]);
|
|
177260
|
+
var TOR_DOWNLOAD_TRIES = TOR_TRY_MS.length;
|
|
177261
|
+
var ROUTE_ERROR = /\b(FETCH_ERROR|ECONNRESET|ETIMEDOUT|ESOCKETTIMEDOUT|ERR_SOCKET_TIMEOUT|ECONNABORTED|EPIPE|EAI_AGAIN|E502|E503|E504)\b/;
|
|
177262
|
+
var routeFailure = (check) => check?.why === "timeout" || check?.why === "stopped" && ROUTE_ERROR.test(String(check.detail ?? ""));
|
|
177263
|
+
var NPM_ONE_TRY_ENVIRONMENT = Object.freeze({ npm_config_fetch_retries: "0" });
|
|
177264
|
+
function newTorRoute(url) {
|
|
177265
|
+
const next = new URL(url);
|
|
177266
|
+
next.username = "tor";
|
|
177267
|
+
next.password = randomBytes49(16).toString("hex");
|
|
177268
|
+
return next.href.replace(/\/$/, "");
|
|
177269
|
+
}
|
|
177201
177270
|
var NPM_OFFLINE_ENVIRONMENT = Object.freeze({ npm_config_offline: "true" });
|
|
177202
177271
|
var NPM_CACHE_KEYS = /* @__PURE__ */ new Set(["npm_config_cache", "npm_config_userconfig", "npm_config_globalconfig", "npm_config_prefix"]);
|
|
177203
177272
|
var hasOwnNpmCacheSettings = (env = process.env) => Object.entries(env).some(([key, value2]) => value2 !== void 0 && NPM_CACHE_KEYS.has(key.toLowerCase()));
|
|
@@ -177217,7 +177286,7 @@ function appEnvironment(entry, { platform = process.platform, env = process.env,
|
|
|
177217
177286
|
return { ...out, ...entry.env ?? {}, ...extra ?? {} };
|
|
177218
177287
|
}
|
|
177219
177288
|
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() } = {}) {
|
|
177289
|
+
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
177290
|
const started = Date.now();
|
|
177222
177291
|
return new Promise((resolveCheck) => {
|
|
177223
177292
|
let child;
|
|
@@ -177228,6 +177297,10 @@ function checkHostEntry(entry, { platform = process.platform, env = process.env,
|
|
|
177228
177297
|
if (settled) return;
|
|
177229
177298
|
settled = true;
|
|
177230
177299
|
clearTimeout(timer);
|
|
177300
|
+
if (endAtOnce && !outcome.ok) {
|
|
177301
|
+
end(child, platform, { now: true }).then(() => resolveCheck(outcome));
|
|
177302
|
+
return;
|
|
177303
|
+
}
|
|
177231
177304
|
end(child, platform);
|
|
177232
177305
|
resolveCheck(outcome);
|
|
177233
177306
|
};
|
|
@@ -177286,8 +177359,8 @@ var lastLine = (text3) => {
|
|
|
177286
177359
|
if (code2) return code2.slice(0, 200);
|
|
177287
177360
|
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
177361
|
};
|
|
177289
|
-
function end(child, platform) {
|
|
177290
|
-
if (!child?.pid) return;
|
|
177362
|
+
function end(child, platform, { now = false } = {}) {
|
|
177363
|
+
if (!child?.pid) return Promise.resolve();
|
|
177291
177364
|
try {
|
|
177292
177365
|
child.stdin.end();
|
|
177293
177366
|
} catch {
|
|
@@ -177305,6 +177378,20 @@ function end(child, platform) {
|
|
|
177305
177378
|
} catch {
|
|
177306
177379
|
}
|
|
177307
177380
|
};
|
|
177381
|
+
if (now) {
|
|
177382
|
+
killTree();
|
|
177383
|
+
return new Promise((resolveEnd) => {
|
|
177384
|
+
if (child.exitCode !== null || child.signalCode !== null) {
|
|
177385
|
+
resolveEnd();
|
|
177386
|
+
return;
|
|
177387
|
+
}
|
|
177388
|
+
const wait2 = setTimeout(resolveEnd, 1e4);
|
|
177389
|
+
child.once("exit", () => {
|
|
177390
|
+
clearTimeout(wait2);
|
|
177391
|
+
resolveEnd();
|
|
177392
|
+
});
|
|
177393
|
+
});
|
|
177394
|
+
}
|
|
177308
177395
|
const kill = setTimeout(killTree, 15e3);
|
|
177309
177396
|
if (platform === "win32") {
|
|
177310
177397
|
kill.unref?.();
|
|
@@ -177319,6 +177406,7 @@ function end(child, platform) {
|
|
|
177319
177406
|
poll = setInterval(gone, 1e3);
|
|
177320
177407
|
gone();
|
|
177321
177408
|
}
|
|
177409
|
+
return Promise.resolve();
|
|
177322
177410
|
}
|
|
177323
177411
|
function groupHoldsOwn(pgid, sinceMs) {
|
|
177324
177412
|
if (!groupAlive(pgid)) return false;
|
|
@@ -177363,7 +177451,9 @@ function hostCheckWords(app, check) {
|
|
|
177363
177451
|
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
177452
|
}
|
|
177365
177453
|
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.`;
|
|
177454
|
+
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
177455
|
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.`;
|
|
177456
|
+
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
177457
|
return `${app} could not start the wallet (${check.detail}). Do this step again.`;
|
|
177368
177458
|
}
|
|
177369
177459
|
|
|
@@ -178737,11 +178827,13 @@ function setupHeader(paint2, columns = 80, title = "set up the wallet") {
|
|
|
178737
178827
|
return `\x1B[0m\x1B[2J\x1B[H${commandHeader(columns, title)}
|
|
178738
178828
|
`;
|
|
178739
178829
|
}
|
|
178740
|
-
function setupFooter(paint2, columns = 80) {
|
|
178830
|
+
function setupFooter(paint2, columns = 80, { notReady } = {}) {
|
|
178741
178831
|
const width = Math.max(20, Math.min((columns || 80) - 1, 100));
|
|
178832
|
+
const done = notReady ? `${paint2([["\u25C6 ", "crim"], ["setup: wallet made, not ready for an agent app yet", "bone"]])}
|
|
178833
|
+
${paint2([[" ", ""], [notReady, "bone"]])}` : paint2([["\u25C6 ", "crim"], ["setup: done", "bone"]]);
|
|
178742
178834
|
return `
|
|
178743
178835
|
${paint2([["\u2500".repeat(width), "ash"]])}
|
|
178744
|
-
${
|
|
178836
|
+
${done}
|
|
178745
178837
|
${commandFooter(columns)}`;
|
|
178746
178838
|
}
|
|
178747
178839
|
|
|
@@ -179897,7 +179989,7 @@ var wentOut = (kept2) => kept2?.committed === true && kept2.cancelled !== true;
|
|
|
179897
179989
|
function personClaim(values, deps, { key, prefix, what }) {
|
|
179898
179990
|
const home = setupHome(deps.env);
|
|
179899
179991
|
const homeJob = inHomeJob(deps.env);
|
|
179900
|
-
const fresh = () => `${prefix}-${
|
|
179992
|
+
const fresh = () => `${prefix}-${randomBytes52(8).toString("hex")}`;
|
|
179901
179993
|
let claim;
|
|
179902
179994
|
try {
|
|
179903
179995
|
claim = claimLinkPayment(home, key, fresh());
|
|
@@ -179946,7 +180038,7 @@ async function personRun(values, deps, person, run2) {
|
|
|
179946
180038
|
releaseLinkPayment(home, key, { drop: false });
|
|
179947
180039
|
words2 = `${words2.replace(/[.\s]+$/, "")}. The wallet could not read its payment record now, so it keeps this payment: ${again}: it never pays twice`;
|
|
179948
180040
|
} else if (mismatch && !wentOut(read2.kept)) {
|
|
179949
|
-
renewLinkPayment(home, key, requestId, `${requestId.split("-")[0]}-${
|
|
180041
|
+
renewLinkPayment(home, key, requestId, `${requestId.split("-")[0]}-${randomBytes52(8).toString("hex")}`);
|
|
179950
180042
|
releaseLinkPayment(home, key, { drop: false });
|
|
179951
180043
|
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
180044
|
} else if (mismatch) {
|
|
@@ -179977,14 +180069,14 @@ async function runCurlRequest(values, deps) {
|
|
|
179977
180069
|
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
180070
|
}
|
|
179979
180071
|
const io = deps.io;
|
|
179980
|
-
const requestId = values.get("--request-id") ?? values.get(LINK_REQUEST_ID) ?? `curl-${
|
|
180072
|
+
const requestId = values.get("--request-id") ?? values.get(LINK_REQUEST_ID) ?? `curl-${randomBytes52(8).toString("hex")}`;
|
|
179981
180073
|
let kept2;
|
|
179982
180074
|
if (values.has("--request-id")) {
|
|
179983
180075
|
const { walletPath: walletPath2, passphrase: passphrase2 } = payerSessionOptions(values, deps);
|
|
179984
180076
|
kept2 = keptPayment((deps.openWalletStore ?? openWalletStore)(walletPath2, passphrase2), requestId);
|
|
179985
180077
|
if (kept2?.committed) kept2 = void 0;
|
|
179986
180078
|
}
|
|
179987
|
-
const probeId = kept2 ? `curl-${
|
|
180079
|
+
const probeId = kept2 ? `curl-${randomBytes52(8).toString("hex")}` : requestId;
|
|
179988
180080
|
const probe = createSpendPolicy({ maxPaymentAtomic: NO_LIMIT_ATOMIC, allowHosts: ["price-probe.invalid"] });
|
|
179989
180081
|
const body = curlBody(values);
|
|
179990
180082
|
const method = (values.get("--method") ?? (body === void 0 ? "GET" : "POST")).toUpperCase();
|
|
@@ -180038,7 +180130,7 @@ async function runCurlPaid(values, deps, { requestId: probeId } = {}) {
|
|
|
180038
180130
|
const method = (values.get("--method") ?? (body === void 0 ? "GET" : "POST")).toUpperCase();
|
|
180039
180131
|
const headers = (values.get("--header") ?? []).map((line) => [line.slice(0, line.indexOf(":")).trim(), line.slice(line.indexOf(":") + 1).trim()]);
|
|
180040
180132
|
const given = values.get("--request-id");
|
|
180041
|
-
const requestId = given ?? probeId ?? values.get(LINK_REQUEST_ID) ?? `curl-${
|
|
180133
|
+
const requestId = given ?? probeId ?? values.get(LINK_REQUEST_ID) ?? `curl-${randomBytes52(8).toString("hex")}`;
|
|
180042
180134
|
const person = values.get(PERSON_LINK);
|
|
180043
180135
|
const session = await (deps.openPayerSession ?? openPayerSession)({ ...payerSessionOptions(values, deps), spendPolicy: policy });
|
|
180044
180136
|
let response;
|
|
@@ -180712,7 +180804,7 @@ async function runInfer(values, deps) {
|
|
|
180712
180804
|
...terminalDayLimit(values, deps)
|
|
180713
180805
|
});
|
|
180714
180806
|
const given = values.get("--request-id");
|
|
180715
|
-
const requestId = given ?? `infer-${
|
|
180807
|
+
const requestId = given ?? `infer-${randomBytes52(8).toString("hex")}`;
|
|
180716
180808
|
const session = await (deps.openPayerSession ?? openPayerSession)({ ...payerSessionOptions(values, deps), spendPolicy: policy });
|
|
180717
180809
|
const stopWatch = quiet && !given ? idLineOnInterrupt(io, inferStopLine(requestId, values, deps)) : () => {
|
|
180718
180810
|
};
|
|
@@ -182057,7 +182149,7 @@ function mcpTorAheadHome(values, deps) {
|
|
|
182057
182149
|
return firstRun && configOrNull(firstRun.home)?.tor === true ? firstRun.home : void 0;
|
|
182058
182150
|
}
|
|
182059
182151
|
async function torRunOf(args, deps, err) {
|
|
182060
|
-
const startedFile = join60(tmpdir8(), `shinjuku-wallet-tor-run-${
|
|
182152
|
+
const startedFile = join60(tmpdir8(), `shinjuku-wallet-tor-run-${randomBytes52(16).toString("hex")}`);
|
|
182061
182153
|
try {
|
|
182062
182154
|
const code2 = await deps.torReexec(args, { startedFile, err });
|
|
182063
182155
|
return { code: code2, started: existsSync(startedFile) };
|
|
@@ -183069,7 +183161,7 @@ async function runRestoreCommand(values, deps) {
|
|
|
183069
183161
|
if (!restored) {
|
|
183070
183162
|
mkdirSync(home, { recursive: true, mode: 448 });
|
|
183071
183163
|
const ownFile = join60(home, PASSPHRASE_FILE);
|
|
183072
|
-
if (!existsSync(ownFile)) writeRecoveryFile(ownFile,
|
|
183164
|
+
if (!existsSync(ownFile)) writeRecoveryFile(ownFile, randomBytes52(32).toString("base64url"));
|
|
183073
183165
|
await deps.setupInit({ home, passphrase: readSecretText(ownFile, "the passphrase file"), args: [
|
|
183074
183166
|
"restore",
|
|
183075
183167
|
"--pool",
|
|
@@ -183340,8 +183432,24 @@ function hostStartCheck(app, options, deps, { terminal, noTor = false, cwd, intr
|
|
|
183340
183432
|
`);
|
|
183341
183433
|
const start = async (entry) => {
|
|
183342
183434
|
if (!net5.url) return check(entry, { platform, env, terminal, extraEnv: { ...outerProxyEnv(env), ...NPM_ONLINE_ENVIRONMENT }, ...at });
|
|
183343
|
-
|
|
183344
|
-
|
|
183435
|
+
let filled;
|
|
183436
|
+
let tries = 0;
|
|
183437
|
+
for (const timeoutMs of TOR_TRY_MS) {
|
|
183438
|
+
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})...
|
|
183439
|
+
`);
|
|
183440
|
+
tries += 1;
|
|
183441
|
+
filled = await check(withNoProxyArg(entry), {
|
|
183442
|
+
platform,
|
|
183443
|
+
env,
|
|
183444
|
+
terminal,
|
|
183445
|
+
timeoutMs,
|
|
183446
|
+
endAtOnce: true,
|
|
183447
|
+
extraEnv: { ...npmProxyEnvironment(newTorRoute(net5.url)), ...NPM_ONE_TRY_ENVIRONMENT },
|
|
183448
|
+
...at
|
|
183449
|
+
});
|
|
183450
|
+
if (filled.ok || !routeFailure(filled)) break;
|
|
183451
|
+
}
|
|
183452
|
+
if (!filled.ok) return routeFailure(filled) ? { ...filled, tries } : filled;
|
|
183345
183453
|
return check(entry, { platform, env, terminal, extraEnv: NPM_OFFLINE_ENVIRONMENT, ...at });
|
|
183346
183454
|
};
|
|
183347
183455
|
const first = await start(mcpServerEntry(options));
|
|
@@ -183354,6 +183462,7 @@ function hostStartCheck(app, options, deps, { terminal, noTor = false, cwd, intr
|
|
|
183354
183462
|
return hostChecks.get(key);
|
|
183355
183463
|
}
|
|
183356
183464
|
async function fillStartCache(home, deps, { npmVersion, noTor = false, added }) {
|
|
183465
|
+
startCopyMissing = false;
|
|
183357
183466
|
if (added?.size || !npxPackageWord(npmVersion).includes("@")) return;
|
|
183358
183467
|
const options = { home, env: deps.env, platform: deps.platform ?? process.platform, npmVersion };
|
|
183359
183468
|
let overTor = false;
|
|
@@ -183367,9 +183476,13 @@ async function fillStartCache(home, deps, { npmVersion, noTor = false, added })
|
|
|
183367
183476
|
}
|
|
183368
183477
|
});
|
|
183369
183478
|
if (check.ok) return;
|
|
183370
|
-
|
|
183479
|
+
startCopyMissing = true;
|
|
183480
|
+
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.)" : ""}`;
|
|
183481
|
+
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
183482
|
`);
|
|
183372
183483
|
}
|
|
183484
|
+
var startCopyMissing = false;
|
|
183485
|
+
var START_COPY_FIX = "To fix it, open Shinjuku and press c (connect an agent app).";
|
|
183373
183486
|
async function hostCheckProxy(home, deps, noTor) {
|
|
183374
183487
|
let config;
|
|
183375
183488
|
try {
|
|
@@ -184197,6 +184310,7 @@ async function runSetupCommandHeld(values, deps) {
|
|
|
184197
184310
|
deps,
|
|
184198
184311
|
{ force: values.has("--force"), npmVersion, ask: interactive && deps.stdinIsTTY() ? deps.ask : void 0, noTor: values.has("--no-tor") }
|
|
184199
184312
|
) : void 0;
|
|
184313
|
+
if (hosts2?.cacheFilled?.size) startCopyMissing = false;
|
|
184200
184314
|
const added2 = /* @__PURE__ */ new Set([...hosts2?.added ?? [], ...hosts2?.kept ?? []]);
|
|
184201
184315
|
if (readsBack) readEmpty();
|
|
184202
184316
|
else if (addsAppOnly(values, targets)) io.out(addAppOnlyText(targets, new Set(hosts2?.added ?? [])));
|
|
@@ -186551,7 +186665,7 @@ async function runWalletSend(values, deps, io) {
|
|
|
186551
186665
|
const policy = createSpendPolicy({ maxPaymentAtomic: limits?.maxPaymentAtomic ?? amountAtomic, ...terminalDayLimit(values, deps) });
|
|
186552
186666
|
const profile = JSON.parse(readFileSync(resolve44(values.get("--profile")), "utf8"));
|
|
186553
186667
|
const given = values.get("--unshield-id");
|
|
186554
|
-
const requestId = given ?? `send-${
|
|
186668
|
+
const requestId = given ?? `send-${randomBytes52(8).toString("hex")}`;
|
|
186555
186669
|
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
186670
|
`);
|
|
186557
186671
|
const session = await (deps.openPayerSession ?? openPayerSession)({
|
|
@@ -186751,7 +186865,7 @@ async function runUnshieldRequest(args, values, deps, io) {
|
|
|
186751
186865
|
};
|
|
186752
186866
|
const ensureId = () => {
|
|
186753
186867
|
if (id !== void 0) return;
|
|
186754
|
-
id = `unshield-${
|
|
186868
|
+
id = `unshield-${randomBytes52(6).toString("hex")}`;
|
|
186755
186869
|
setArg("--unshield-id", id);
|
|
186756
186870
|
values.set(UNSHIELD_MADE_ID, id);
|
|
186757
186871
|
if (quiet) {
|
|
@@ -187460,7 +187574,7 @@ async function runPayMe(values, deps, io) {
|
|
|
187460
187574
|
} catch {
|
|
187461
187575
|
receiveShielded = void 0;
|
|
187462
187576
|
}
|
|
187463
|
-
const linkId = id ?? `link-${
|
|
187577
|
+
const linkId = id ?? `link-${randomBytes52(6).toString("hex")}`;
|
|
187464
187578
|
const record = await createPayMe({ store, connection, id: linkId, amountAtomic, note: values.get("--note"), ...receiveShielded ? { receiveShielded } : {} });
|
|
187465
187579
|
const view2 = payMeView(record);
|
|
187466
187580
|
if (!terminal) {
|
|
@@ -188187,7 +188301,7 @@ async function runShieldCommand(values, deps, io) {
|
|
|
188187
188301
|
`you did not type y, so nothing was moved. To make it private, ${again}`
|
|
188188
188302
|
);
|
|
188189
188303
|
}
|
|
188190
|
-
depositId = `shield-${
|
|
188304
|
+
depositId = `shield-${randomBytes52(8).toString("hex")}`;
|
|
188191
188305
|
}
|
|
188192
188306
|
writePendingShield(store, depositId, amountAtomic, new Date(deps.now()).toISOString());
|
|
188193
188307
|
try {
|
|
@@ -190094,7 +190208,7 @@ function setupThemeFor(values, deps) {
|
|
|
190094
190208
|
}
|
|
190095
190209
|
async function openShinjukuAfterSetup(argv2, deps, theme2) {
|
|
190096
190210
|
delete deps.env[SETUP_THEME_ENV];
|
|
190097
|
-
deps.io.out(setupFooter(theme2.paint, process.stdout.columns));
|
|
190211
|
+
deps.io.out(setupFooter(theme2.paint, process.stdout.columns, startCopyMissing ? { notReady: START_COPY_FIX } : void 0));
|
|
190098
190212
|
let answer;
|
|
190099
190213
|
try {
|
|
190100
190214
|
answer = String(await theme2.ask("Open Shinjuku now? (Enter = yes) ")).trim();
|