shinjuku-shield 0.3.253 → 0.3.255
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 +8 -8
- package/package.json +3 -3
- package/shinjuku-seller.mjs +5 -1
- package/shinjuku-wallet.mjs +380 -61
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.255. 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.255 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.255, 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": "82657f55e376e4d0998bbd34b3ac591bbddaa0ced57505f7f9f499c92e2b36f1",
|
|
5
|
+
"bytes": 10887357,
|
|
6
|
+
"sourceCommit": "d2f342f4816604eae9e13dba27f508b6d8df3fe0",
|
|
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",
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
"path": "wallet/src/mcp/views/wallet-card.html",
|
|
100
|
-
"sha256": "
|
|
101
|
-
"bytes":
|
|
100
|
+
"sha256": "c7f7eaddf6e124b1315605a97bba65c775bcb2058f4f19d95172a80440107503",
|
|
101
|
+
"bytes": 7732
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
104
|
"path": "wallet/vendor/ext-apps-1.7.5/app-with-deps.js",
|
|
@@ -1075,8 +1075,8 @@
|
|
|
1075
1075
|
],
|
|
1076
1076
|
"seller": {
|
|
1077
1077
|
"file": "shinjuku-seller.mjs",
|
|
1078
|
-
"sha256": "
|
|
1079
|
-
"bytes":
|
|
1078
|
+
"sha256": "149d22a1b3a12820eead9d518b608b8bf1b94e827555d1680c61f7c7cbea0c89",
|
|
1079
|
+
"bytes": 4301749,
|
|
1080
1080
|
"entry": "wallet/src/seller/exact/index.mjs",
|
|
1081
1081
|
"external": [
|
|
1082
1082
|
"@x402/core/http",
|
|
@@ -2080,5 +2080,5 @@
|
|
|
2080
2080
|
}
|
|
2081
2081
|
]
|
|
2082
2082
|
},
|
|
2083
|
-
"publishedAt": "2026-11-
|
|
2083
|
+
"publishedAt": "2026-11-20T05:59:45.742Z"
|
|
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.255",
|
|
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": "82657f55",
|
|
7
|
+
"shinjukuSha256": "82657f55e376e4d0998bbd34b3ac591bbddaa0ced57505f7f9f499c92e2b36f1",
|
|
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-seller.mjs
CHANGED
|
@@ -42282,6 +42282,7 @@ function terminalPathKeys() {
|
|
|
42282
42282
|
}
|
|
42283
42283
|
function typedCommandFor(path, { env, platform = process.platform } = {}) {
|
|
42284
42284
|
const name = typedCommandName(COMMAND_PACKAGE, platform);
|
|
42285
|
+
if (thisWindowTyped && path && platform === process.platform && (env === void 0 || env === process.env) && dirname8(path).replace(/\/+$/, "") === String(pathStepFolder).replace(/\/+$/, "")) return thisWindowTyped;
|
|
42285
42286
|
if (platform !== "win32" || platform !== process.platform || env !== void 0 && env !== process.env || !path) return name;
|
|
42286
42287
|
const keys3 = terminalPathKeys();
|
|
42287
42288
|
if (!keys3 || keys3.has(folderKey(dirname8(path)))) return name;
|
|
@@ -42351,7 +42352,7 @@ function installedCommand(options = {}) {
|
|
|
42351
42352
|
}
|
|
42352
42353
|
return { path };
|
|
42353
42354
|
}
|
|
42354
|
-
var versionSource, ownNpmVersion, runningNpmVersion, NPM_RUN_FOLDER, isRunnable, kept, keptTerminal, keptSame, folderKey, OWN_PACKAGES, readPackage;
|
|
42355
|
+
var versionSource, ownNpmVersion, runningNpmVersion, NPM_RUN_FOLDER, isRunnable, kept, keptTerminal, keptSame, folderKey, pathStepFolder, thisWindowTyped, OWN_PACKAGES, readPackage;
|
|
42355
42356
|
var init_commandName = __esm({
|
|
42356
42357
|
"wallet/src/cli/commandName.mjs"() {
|
|
42357
42358
|
"use strict";
|
|
@@ -46052,6 +46053,7 @@ var init_errorCodes = __esm({
|
|
|
46052
46053
|
"inference_messages_invalid",
|
|
46053
46054
|
"inference_tools_invalid",
|
|
46054
46055
|
"inference_model_unknown",
|
|
46056
|
+
"inference_model_not_offered",
|
|
46055
46057
|
"inference_no_provider",
|
|
46056
46058
|
"inference_origin_refused",
|
|
46057
46059
|
"inference_out_of_tokens",
|
|
@@ -47631,6 +47633,8 @@ var init_errorCodes = __esm({
|
|
|
47631
47633
|
"max_tokens",
|
|
47632
47634
|
"inference_models",
|
|
47633
47635
|
"inference_chat",
|
|
47636
|
+
"ask_deepseek_private",
|
|
47637
|
+
"ask_kimi_private",
|
|
47634
47638
|
"inference_server",
|
|
47635
47639
|
"mcp_tool_disabled",
|
|
47636
47640
|
"mcp_unshield_to_not_allowed",
|
package/shinjuku-wallet.mjs
CHANGED
|
@@ -699,11 +699,32 @@ var init_fs = __esm({
|
|
|
699
699
|
var button = document.getElementById("refresh");
|
|
700
700
|
button.addEventListener("click", function () { S.refresh(current, button); });
|
|
701
701
|
var body = document.getElementById("body");
|
|
702
|
+
// The first view this card drew (its rev and balance): a later, newer view came from Refresh (views/shared.js draws only
|
|
703
|
+
// a newer rev). Row 119 on 0.3.254 (Codex app, 2026-11-20, review finding 8): after Refresh the card said "You can spend
|
|
704
|
+
// 0.1 USDC now" while the chat text under it, written from the first answer, still said 0 USDC. The card cannot change
|
|
705
|
+
// that text: it says when it was updated and that it is newer, and gives the app's model the new words (tellModel), so
|
|
706
|
+
// the next chat answer uses them. Session-made, 2026-11-20 (its commit names it).
|
|
707
|
+
var firstRev = 0;
|
|
708
|
+
var firstBalance = null;
|
|
709
|
+
var toldRev = 0;
|
|
710
|
+
var utcTime = function (ms) { var iso = new Date(ms).toISOString(); return iso.slice(11, 16) + " UTC"; };
|
|
702
711
|
S.start(function (view, data) {
|
|
703
712
|
current = view;
|
|
704
713
|
body.hidden = false;
|
|
705
|
-
|
|
706
|
-
document.getElementById("
|
|
714
|
+
var balanceText = view.balance !== null && view.balance !== undefined ? view.balance + " USDC" : "being checked";
|
|
715
|
+
document.getElementById("balance").textContent = balanceText;
|
|
716
|
+
var rev = typeof data.rev === "number" && isFinite(data.rev) && data.rev > 0 ? data.rev : 0;
|
|
717
|
+
if (!firstRev) { firstRev = rev; firstBalance = balanceText; }
|
|
718
|
+
var updated = rev > firstRev;
|
|
719
|
+
var changed = updated && balanceText !== firstBalance;
|
|
720
|
+
document.getElementById("note").textContent = updated
|
|
721
|
+
? "Updated " + utcTime(rev) + (changed ? ": newer than the chat text about this balance" : "") + (view.note ? ". " + view.note : "")
|
|
722
|
+
: view.note || "";
|
|
723
|
+
if (changed && rev > toldRev && typeof data.say === "string" && data.say) {
|
|
724
|
+
toldRev = rev;
|
|
725
|
+
S.tellModel("The user pressed Refresh on the Shinjuku Shield balance card at " + utcTime(rev) + ". The wallet now says: " + data.say
|
|
726
|
+
+ " This is newer than any balance said earlier in this chat; use it, and do not repeat the older number.");
|
|
727
|
+
}
|
|
707
728
|
var rows = document.getElementById("rows");
|
|
708
729
|
rows.replaceChildren();
|
|
709
730
|
if (view.publicUsdc !== null && view.publicUsdc !== undefined) rows.appendChild(S.row("Public USDC on your own address", view.publicUsdc + " USDC"));
|
|
@@ -718,7 +739,8 @@ var init_fs = __esm({
|
|
|
718
739
|
// No Refresh for a host that does not pass a view's tool calls to the wallet (the chat asks again there).
|
|
719
740
|
button.hidden = !S.canCallServer();
|
|
720
741
|
button.disabled = !(view.refresh && view.refresh.tool) || button.hidden;
|
|
721
|
-
|
|
742
|
+
// A card after a payment (tools.mjs paidCardView) shows its own short line, not the AI answer or the seller's data.
|
|
743
|
+
S.message(typeof view.message === "string" && view.message ? view.message : typeof data.say === "string" ? data.say : "");
|
|
722
744
|
}, function (result, fallback) {
|
|
723
745
|
// No balance view in this answer (a refusal, an error, a failed Refresh): no old or empty balance stays on screen.
|
|
724
746
|
current = null;
|
|
@@ -739,7 +761,7 @@ var init_fs = __esm({
|
|
|
739
761
|
return !!payment && typeof payment === "object" && typeof payment.at === "string" && typeof payment.host === "string" && usdc(payment.usdc);
|
|
740
762
|
};
|
|
741
763
|
return data.ok === true && view.kind === "wallet-card" && (view.balance === null || usdc(view.balance))
|
|
742
|
-
&& (view.publicUsdc === undefined || view.publicUsdc === null || usdc(view.publicUsdc)) && text(view.note)
|
|
764
|
+
&& (view.publicUsdc === undefined || view.publicUsdc === null || usdc(view.publicUsdc)) && text(view.note) && text(view.message)
|
|
743
765
|
&& (view.payments === undefined || view.payments === null || (Array.isArray(view.payments) && view.payments.every(row)));
|
|
744
766
|
});
|
|
745
767
|
})();
|
|
@@ -51224,13 +51246,19 @@ function stepName(words2, line, { env = process.env } = {}) {
|
|
|
51224
51246
|
const key = homeKeyOf(words2);
|
|
51225
51247
|
return inHomeJob(env) && key ? `press [${key}] on the home screen` : line;
|
|
51226
51248
|
}
|
|
51227
|
-
var HOME_JOB_ENV, LAUNCHER_PID_ENV, inHomeJob, HOME_KEY, JOB_NAME, jobLabel, homeKeyOf;
|
|
51249
|
+
var HOME_JOB_ENV, LAUNCHER_PID_ENV, inHomeJob, JOB_BAR_ROWS, JOB_BAR_MIN_ROWS, JOB_LINE_WORDS, JOB_BAR_ENV, holdsJobBar, jobRows, HOME_KEY, JOB_NAME, jobLabel, homeKeyOf;
|
|
51228
51250
|
var init_homeJob = __esm({
|
|
51229
51251
|
"wallet/src/cli/homeJob.mjs"() {
|
|
51230
51252
|
"use strict";
|
|
51231
51253
|
HOME_JOB_ENV = "SHINJUKU_WALLET_HOME_JOB";
|
|
51232
51254
|
LAUNCHER_PID_ENV = "SHINJUKU_WALLET_LAUNCHER_PID";
|
|
51233
51255
|
inHomeJob = (env = process.env) => env?.[HOME_JOB_ENV] === "1";
|
|
51256
|
+
JOB_BAR_ROWS = 2;
|
|
51257
|
+
JOB_BAR_MIN_ROWS = 10;
|
|
51258
|
+
JOB_LINE_WORDS = ["\u25C6 ", "shinjuku-shield", " \xB7 "];
|
|
51259
|
+
JOB_BAR_ENV = "SHINJUKU_WALLET_JOB_BAR";
|
|
51260
|
+
holdsJobBar = (rows2, columns, name) => Boolean(name) && Number.isSafeInteger(rows2) && rows2 >= JOB_BAR_MIN_ROWS && (Number.isSafeInteger(columns) ? columns : 80) >= [...`${JOB_LINE_WORDS.join("")}${name}`].length + 1;
|
|
51261
|
+
jobRows = (rows2, env = process.env, columns = void 0) => holdsJobBar(rows2, columns, env?.[JOB_BAR_ENV]) ? rows2 - JOB_BAR_ROWS : rows2;
|
|
51234
51262
|
HOME_KEY = { "add-funds": "a", unshield: "u", "pay-me": "g", curl: "p", chat: "t", setup: "s", restore: "r", limits: "l" };
|
|
51235
51263
|
JOB_NAME = {
|
|
51236
51264
|
"add-funds": "add funds",
|
|
@@ -52212,7 +52240,8 @@ ${command}`;
|
|
|
52212
52240
|
const plain = plainTorTrouble(text3);
|
|
52213
52241
|
if (plain !== void 0) {
|
|
52214
52242
|
if (plain) {
|
|
52215
|
-
|
|
52243
|
+
if (process.stderr.isTTY) err("\r\x1B[K");
|
|
52244
|
+
err(`${plain}
|
|
52216
52245
|
`);
|
|
52217
52246
|
try {
|
|
52218
52247
|
promptRedraw?.();
|
|
@@ -61569,6 +61598,7 @@ function terminalPathKeys() {
|
|
|
61569
61598
|
}
|
|
61570
61599
|
function typedCommandFor(path, { env, platform = process.platform } = {}) {
|
|
61571
61600
|
const name = typedCommandName(COMMAND_PACKAGE, platform);
|
|
61601
|
+
if (thisWindowTyped && path && platform === process.platform && (env === void 0 || env === process.env) && dirname12(path).replace(/\/+$/, "") === String(pathStepFolder).replace(/\/+$/, "")) return thisWindowTyped;
|
|
61572
61602
|
if (platform !== "win32" || platform !== process.platform || env !== void 0 && env !== process.env || !path) return name;
|
|
61573
61603
|
const keys3 = terminalPathKeys();
|
|
61574
61604
|
if (!keys3 || keys3.has(folderKey2(dirname12(path)))) return name;
|
|
@@ -61643,13 +61673,25 @@ function windowsNpmFolderOffPath({ env = process.env, platform = process.platfor
|
|
|
61643
61673
|
function notePathStep(state2, folder) {
|
|
61644
61674
|
pathStepSaid = state2;
|
|
61645
61675
|
pathStepFolder = folder;
|
|
61676
|
+
const trim = (dir) => String(dir).replace(/\/+$/, "");
|
|
61677
|
+
const here4 = String(process.env.PATH ?? "").split(":").some((dir) => dir && trim(dir) === trim(folder));
|
|
61678
|
+
thisWindowTyped = (state2 === "profile-added" || state2 === "profile-present") && folder && process.platform !== "win32" && !here4 ? posixTyped(join13(folder, COMMAND_PACKAGE)) : void 0;
|
|
61679
|
+
if (thisWindowTyped) refreshCommandName();
|
|
61680
|
+
}
|
|
61681
|
+
function posixTyped(file, home = process.env.HOME) {
|
|
61682
|
+
const plain = /^[A-Za-z0-9._\/-]+$/;
|
|
61683
|
+
if (home && file.startsWith(`${home.replace(/\/+$/, "")}/`)) {
|
|
61684
|
+
const rest = file.slice(home.replace(/\/+$/, "").length + 1);
|
|
61685
|
+
if (plain.test(rest)) return `~/${rest}`;
|
|
61686
|
+
}
|
|
61687
|
+
return plain.test(file) ? file : `'${file.replace(/'/g, "'\\''")}'`;
|
|
61646
61688
|
}
|
|
61647
61689
|
function terminalUseLinesHere(npmVersion, options = {}) {
|
|
61648
61690
|
const platform = options.platform ?? process.platform;
|
|
61649
61691
|
const help = `${typedCommandName(COMMAND_PACKAGE, platform)} help`;
|
|
61650
61692
|
if (pathStepSaid && options.env === void 0) {
|
|
61651
61693
|
const node3 = nodeFirstSentence({ folder: pathStepFolder, platform });
|
|
61652
|
-
if (pathStepSaid === "profile-added" || pathStepSaid === "profile-present") return [...node3 ? [node3] : [],
|
|
61694
|
+
if (pathStepSaid === "profile-added" || pathStepSaid === "profile-present") return [...node3 ? [node3] : [], ...thisWindowLines("help")];
|
|
61653
61695
|
return [
|
|
61654
61696
|
...node3 ? [node3] : [],
|
|
61655
61697
|
pathStepSaid === "profile" ? `After that profile line, a new terminal types ${help} and the other commands. In this terminal, type the longer command, for example:` : pathStepSaid === "failed" ? `After you add that folder to your PATH, a new window types ${help} and the other commands. In this window, type the longer command, for example:` : `Open a new window to type ${help} and the other commands. In this window, type the longer command, for example:`,
|
|
@@ -61662,6 +61704,15 @@ function terminalUseLinesHere(npmVersion, options = {}) {
|
|
|
61662
61704
|
` ${oneTimeCommandLine("balance", npmVersion, { platform })}`
|
|
61663
61705
|
];
|
|
61664
61706
|
}
|
|
61707
|
+
function thisWindowLines(words2) {
|
|
61708
|
+
if (!thisWindowTyped) return [];
|
|
61709
|
+
const line = words2 ? `${thisWindowTyped} ${words2}` : thisWindowTyped;
|
|
61710
|
+
return [
|
|
61711
|
+
`This window does not know the ${COMMAND_PACKAGE} command yet. In this window, type:`,
|
|
61712
|
+
` ${line}`,
|
|
61713
|
+
`A new terminal knows ${COMMAND_PACKAGE}: there, type ${words2 ? `${COMMAND_PACKAGE} ${words2}` : COMMAND_PACKAGE}.`
|
|
61714
|
+
];
|
|
61715
|
+
}
|
|
61665
61716
|
function compareNpmVersions(a, b) {
|
|
61666
61717
|
const x = NPM_VERSION.exec(String(a ?? ""));
|
|
61667
61718
|
const y = NPM_VERSION.exec(String(b ?? ""));
|
|
@@ -61717,7 +61768,7 @@ function olderInstalledCommand(npmVersion = ownNpmVersion(), options = {}) {
|
|
|
61717
61768
|
line: plain ? installCommandText({ platform }) : oneTimeCommandLine("setup", npmVersion, { platform })
|
|
61718
61769
|
};
|
|
61719
61770
|
}
|
|
61720
|
-
var versionSource, ownNpmVersion, runningNpmVersion, NPM_RUN_FOLDER, isRunnable, kept, keptTerminal, keptSame, NODE_FIRST_WORDS, NODE_FIRST_SENTENCE, folderKey2, pathStepSaid, pathStepFolder, OWN_PACKAGES, readPackage;
|
|
61771
|
+
var versionSource, ownNpmVersion, runningNpmVersion, NPM_RUN_FOLDER, isRunnable, kept, keptTerminal, keptSame, NODE_FIRST_WORDS, NODE_FIRST_SENTENCE, folderKey2, pathStepSaid, pathStepFolder, thisWindowTyped, OWN_PACKAGES, readPackage;
|
|
61721
61772
|
var init_commandName = __esm({
|
|
61722
61773
|
"wallet/src/cli/commandName.mjs"() {
|
|
61723
61774
|
"use strict";
|
|
@@ -81208,6 +81259,7 @@ var init_errorCodes = __esm({
|
|
|
81208
81259
|
"inference_messages_invalid",
|
|
81209
81260
|
"inference_tools_invalid",
|
|
81210
81261
|
"inference_model_unknown",
|
|
81262
|
+
"inference_model_not_offered",
|
|
81211
81263
|
"inference_no_provider",
|
|
81212
81264
|
"inference_origin_refused",
|
|
81213
81265
|
"inference_out_of_tokens",
|
|
@@ -82787,6 +82839,8 @@ var init_errorCodes = __esm({
|
|
|
82787
82839
|
"max_tokens",
|
|
82788
82840
|
"inference_models",
|
|
82789
82841
|
"inference_chat",
|
|
82842
|
+
"ask_deepseek_private",
|
|
82843
|
+
"ask_kimi_private",
|
|
82790
82844
|
"inference_server",
|
|
82791
82845
|
"mcp_tool_disabled",
|
|
82792
82846
|
"mcp_unshield_to_not_allowed",
|
|
@@ -127428,7 +127482,7 @@ var init_say = __esm({
|
|
|
127428
127482
|
init_programStart();
|
|
127429
127483
|
SAY_MAX_WORDS = 25;
|
|
127430
127484
|
CHECK_FIRST = "Ask for your Shinjuku balance before you try again.";
|
|
127431
|
-
MONEY_TOOLS = /* @__PURE__ */ new Set(["pay_for_service", "inference_chat", "wallet_unshield", "wallet_shield", "wallet_shield_from_elsewhere"]);
|
|
127485
|
+
MONEY_TOOLS = /* @__PURE__ */ new Set(["pay_for_service", "inference_chat", "ask_deepseek_private", "ask_kimi_private", "wallet_unshield", "wallet_shield", "wallet_shield_from_elsewhere"]);
|
|
127432
127486
|
nextStepOf = (tool) => tool === void 0 || MONEY_TOOLS.has(tool) ? CHECK_FIRST : "Ask again.";
|
|
127433
127487
|
DECIMALS = 6;
|
|
127434
127488
|
ATOMIC9 = /^[0-9]{1,31}$/;
|
|
@@ -149073,6 +149127,48 @@ ${key}`).digest("hex").slice(0, 40)}.json`);
|
|
|
149073
149127
|
if (waited === void 0) return torWaitingAnswer(what);
|
|
149074
149128
|
return waited.output;
|
|
149075
149129
|
}
|
|
149130
|
+
function askPrivateTool(chat, name, company) {
|
|
149131
|
+
const label = `${company} Private`;
|
|
149132
|
+
const { model: _model, ...properties } = chat.inputSchema.properties;
|
|
149133
|
+
return {
|
|
149134
|
+
name,
|
|
149135
|
+
title: `Ask ${label} (a private AI model), paid privately`,
|
|
149136
|
+
description: `Ask ${label} one question: the uncensored ${company} model through Shinjuku's own AI address (it does not store the question), paid privately from the PRIVATE balance. Use this for any request to ask ` + label + ', never your own answer. Pass prompt (or messages). It is inference_chat with that model: the same price (inference_models lists it), spending limits, request_id rules and Tor rule (with Tor off the wallet asks the user to turn Tor on; nothing is paid without Tor). Example: { "prompt": "Name one ocean" }.',
|
|
149137
|
+
inputSchema: { ...chat.inputSchema, properties },
|
|
149138
|
+
annotations: { ...chat.annotations },
|
|
149139
|
+
// The same balance card as inference_chat after a payment (chat.run adds its data): the listing names the view too.
|
|
149140
|
+
...typeof chat.view === "string" ? { view: chat.view } : {},
|
|
149141
|
+
async run(args = {}, ctx = {}) {
|
|
149142
|
+
if ((args?.prompt === void 0 || args.prompt === null) && (args?.messages === void 0 || args.messages === null)) {
|
|
149143
|
+
return refuse11(
|
|
149144
|
+
"inference_messages_invalid",
|
|
149145
|
+
`no prompt or messages were given, so nothing was asked of ${label} and nothing was paid`,
|
|
149146
|
+
`ask the user what to ask ${label}, then call ${name} with prompt`,
|
|
149147
|
+
{ say: `What should I ask ${label}? Nothing was paid.` }
|
|
149148
|
+
);
|
|
149149
|
+
}
|
|
149150
|
+
if (!proxied()) return chat.run({ ...args }, ctx);
|
|
149151
|
+
let ai;
|
|
149152
|
+
try {
|
|
149153
|
+
ai = await shinjukuAiModels({ proxied: true });
|
|
149154
|
+
} catch {
|
|
149155
|
+
ai = void 0;
|
|
149156
|
+
}
|
|
149157
|
+
const id = ai?.models?.find((entry) => typeof entry?.id === "string" && modelFamily(entry.id) === company)?.id;
|
|
149158
|
+
if (!id) {
|
|
149159
|
+
const why = ai?.paused ? "Shinjuku's AI address is paused" : ai?.checked ? `Shinjuku's AI list has no ${company} model now` : "Shinjuku's AI list could not be read";
|
|
149160
|
+
log(`MCP_ASK_PRIVATE_NO_MODEL tool=${name} checked=${ai?.checked === true} paused=${ai?.paused === true}`);
|
|
149161
|
+
return refuse11(
|
|
149162
|
+
"inference_model_not_offered",
|
|
149163
|
+
`${why}; nothing was asked or paid`,
|
|
149164
|
+
`Tell the user ${label} is not available right now and nothing was paid; inference_models lists the models that are`,
|
|
149165
|
+
{ say: `${label} is not available right now. Nothing was paid.` }
|
|
149166
|
+
);
|
|
149167
|
+
}
|
|
149168
|
+
return chat.run({ ...args, model: id }, ctx);
|
|
149169
|
+
}
|
|
149170
|
+
};
|
|
149171
|
+
}
|
|
149076
149172
|
const progressEveryMs = Number.isSafeInteger(ops.progressEveryMs) && ops.progressEveryMs > 0 ? ops.progressEveryMs : PROGRESS_EVERY_MS2;
|
|
149077
149173
|
const statusWait = (promises, ms, progress2, message) => waitOrProgress(promises, ms, { progress: progress2, message, everyMs: progressEveryMs });
|
|
149078
149174
|
const NOT_ALLOWED_WORDS = Object.freeze({
|
|
@@ -149471,23 +149567,27 @@ ${key}`).digest("hex").slice(0, 40)}.json`);
|
|
|
149471
149567
|
const poolWatchPollMs = ops.poolWatchPollMs ?? POOL_WATCH_POLL_MS;
|
|
149472
149568
|
let poolWatchUntil = 0;
|
|
149473
149569
|
let poolWatchTimer;
|
|
149474
|
-
|
|
149475
|
-
|
|
149476
|
-
const walkIfPoolMoved = async () => {
|
|
149477
|
-
if (poolCountReading) return;
|
|
149478
|
-
poolCountReading = true;
|
|
149570
|
+
let poolWatchSlow = false;
|
|
149571
|
+
const watchMark = () => {
|
|
149479
149572
|
let timing;
|
|
149480
149573
|
try {
|
|
149481
149574
|
timing = typeof session.timing === "function" ? session.timing() : void 0;
|
|
149482
149575
|
} catch {
|
|
149483
149576
|
timing = void 0;
|
|
149484
149577
|
}
|
|
149485
|
-
|
|
149578
|
+
return timing ? (phase, outcome) => {
|
|
149486
149579
|
try {
|
|
149487
149580
|
timing(phase, outcome);
|
|
149488
149581
|
} catch {
|
|
149489
149582
|
}
|
|
149490
149583
|
} : void 0;
|
|
149584
|
+
};
|
|
149585
|
+
const noWalkRuns = () => paysInFlight === 0 && !refreshRun && !finalityWait && !historyPrewarmRunning();
|
|
149586
|
+
let poolCountReading = false;
|
|
149587
|
+
const walkIfPoolMoved = async () => {
|
|
149588
|
+
if (poolCountReading) return;
|
|
149589
|
+
poolCountReading = true;
|
|
149590
|
+
const mark = watchMark();
|
|
149491
149591
|
try {
|
|
149492
149592
|
const store = session.openStore();
|
|
149493
149593
|
const pool2 = String(store.state.pool);
|
|
@@ -149514,10 +149614,20 @@ ${key}`).digest("hex").slice(0, 40)}.json`);
|
|
|
149514
149614
|
const watchPool = () => {
|
|
149515
149615
|
if (!poolWatchOn || finalityClosed) return;
|
|
149516
149616
|
poolWatchUntil = Date.now() + (ops.poolWatchMs ?? POOL_WATCH_MS);
|
|
149517
|
-
if (poolWatchTimer !== void 0)
|
|
149617
|
+
if (poolWatchTimer !== void 0) {
|
|
149618
|
+
if (poolWatchSlow) {
|
|
149619
|
+
clearTimeout(poolWatchTimer);
|
|
149620
|
+
poolWatchTimer = void 0;
|
|
149621
|
+
} else return;
|
|
149622
|
+
}
|
|
149623
|
+
const next = () => {
|
|
149624
|
+
poolWatchSlow = Date.now() > poolWatchUntil;
|
|
149625
|
+
poolWatchTimer = setTimeout(tick, poolWatchSlow ? ops.poolWatchSlowMs ?? POOL_WATCH_SLOW_MS : poolWatchPollMs);
|
|
149626
|
+
poolWatchTimer.unref?.();
|
|
149627
|
+
};
|
|
149518
149628
|
const tick = () => {
|
|
149519
149629
|
poolWatchTimer = void 0;
|
|
149520
|
-
if (finalityClosed
|
|
149630
|
+
if (finalityClosed) return;
|
|
149521
149631
|
if (noWalkRuns()) {
|
|
149522
149632
|
if (inTorRun()) void walkIfPoolMoved();
|
|
149523
149633
|
else warmPaymentHistory(session);
|
|
@@ -149527,16 +149637,17 @@ ${key}`).digest("hex").slice(0, 40)}.json`);
|
|
|
149527
149637
|
refreshKeptFloatConfig({ origin: new URL(session.memoServiceUrl).origin });
|
|
149528
149638
|
} catch {
|
|
149529
149639
|
}
|
|
149530
|
-
|
|
149531
|
-
|
|
149532
|
-
|
|
149640
|
+
if (!poolWatchSlow) {
|
|
149641
|
+
try {
|
|
149642
|
+
startPaymentToolsStandby(session.proofTools);
|
|
149643
|
+
} catch {
|
|
149644
|
+
}
|
|
149533
149645
|
}
|
|
149534
149646
|
}
|
|
149535
|
-
|
|
149536
|
-
|
|
149647
|
+
withPhaseScope(watchMark(), "watch", () => markPhase(poolWatchSlow ? "tick-slow" : "tick"));
|
|
149648
|
+
next();
|
|
149537
149649
|
};
|
|
149538
|
-
|
|
149539
|
-
poolWatchTimer.unref?.();
|
|
149650
|
+
next();
|
|
149540
149651
|
};
|
|
149541
149652
|
const readBalance = (store, onPhase) => balanceFields(balanceNow(store, { programId: session.programId, onPhase }));
|
|
149542
149653
|
const readBalanceNow = () => {
|
|
@@ -160788,6 +160899,20 @@ ${JSON.stringify(args ?? {})}`;
|
|
|
160788
160899
|
done: "private now",
|
|
160789
160900
|
expired: "closed"
|
|
160790
160901
|
});
|
|
160902
|
+
const paidCardView = (answer) => {
|
|
160903
|
+
if (answer.ok !== true || answer.paid !== true || answer.replayed === true || !ATOMIC_TEXT.test(String(answer.paidAtomic ?? "")) || !ATOMIC_TEXT.test(String(answer.balanceAtomic ?? ""))) return void 0;
|
|
160904
|
+
return {
|
|
160905
|
+
kind: "wallet-card",
|
|
160906
|
+
balance: usdcText3(answer.balanceAtomic),
|
|
160907
|
+
note: `After this payment of ${usdcText3(answer.paidAtomic)} USDC`,
|
|
160908
|
+
publicUsdc: null,
|
|
160909
|
+
publicNotRead: false,
|
|
160910
|
+
tor: null,
|
|
160911
|
+
payments: null,
|
|
160912
|
+
message: `You can spend ${usdcText3(answer.balanceAtomic)} USDC now.`,
|
|
160913
|
+
refresh: { tool: "wallet_balance", arguments: {} }
|
|
160914
|
+
};
|
|
160915
|
+
};
|
|
160791
160916
|
const VIEW_TOOLS = Object.freeze({
|
|
160792
160917
|
wallet_balance: { uri: "ui://shinjuku/wallet-card", appVisible: true, build: (answer) => {
|
|
160793
160918
|
if (answer.ok === false) return void 0;
|
|
@@ -160824,6 +160949,13 @@ ${JSON.stringify(args ?? {})}`;
|
|
|
160824
160949
|
refresh: { tool: "wallet_balance", arguments: {} }
|
|
160825
160950
|
};
|
|
160826
160951
|
} },
|
|
160952
|
+
// Row 119 on 0.3.254 (Codex app, 2026-11-20, Codex review finding 8): a balance card read before an AI answer ("You can
|
|
160953
|
+
// spend 0.1 USDC now") stayed the newest card beside the paid Kimi answer. A paid AI answer or seller payment already
|
|
160954
|
+
// carries the balance after it (balanceAnswer from the saved walk; that run's answers: 0.068468, 0.066379, 0.062731,
|
|
160955
|
+
// each exactly the one before less paidAtomic), so it draws the same card with that balance. Session-made, 2026-11-20
|
|
160956
|
+
// (its commit names it).
|
|
160957
|
+
inference_chat: { uri: "ui://shinjuku/wallet-card", build: (answer) => paidCardView(answer) },
|
|
160958
|
+
pay_for_service: { uri: "ui://shinjuku/wallet-card", build: (answer) => paidCardView(answer) },
|
|
160827
160959
|
check_price: { uri: "ui://shinjuku/price-card", build: (answer, args, { cardable = true } = {}) => {
|
|
160828
160960
|
let host = "";
|
|
160829
160961
|
try {
|
|
@@ -161232,6 +161364,8 @@ ${JSON.stringify(args ?? {})}`;
|
|
|
161232
161364
|
))));
|
|
161233
161365
|
for (let at = 0; at < tools.length; at += 1) tools[at] = withView(tools[at]);
|
|
161234
161366
|
tools.push(cardPayTool(tools.find((tool) => tool.name === "pay_for_service")));
|
|
161367
|
+
const chatTool = tools.find((tool) => tool.name === "inference_chat");
|
|
161368
|
+
for (const [name, company] of ASK_PRIVATE_TOOLS) tools.push(askPrivateTool(chatTool, name, company));
|
|
161235
161369
|
tools.push({
|
|
161236
161370
|
name: "wallet_tor",
|
|
161237
161371
|
title: "Turn Tor on",
|
|
@@ -161975,7 +162109,7 @@ function createSetupTools({
|
|
|
161975
162109
|
finalPending
|
|
161976
162110
|
};
|
|
161977
162111
|
}
|
|
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;
|
|
162112
|
+
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, ASK_PRIVATE_TOOLS, 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, POOL_WATCH_SLOW_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;
|
|
161979
162113
|
var init_tools = __esm({
|
|
161980
162114
|
"wallet/src/mcp/tools.mjs"() {
|
|
161981
162115
|
"use strict";
|
|
@@ -162157,6 +162291,8 @@ var init_tools = __esm({
|
|
|
162157
162291
|
inference_server: "Starts, stops or checks a private AI address on this computer for your other AI apps.",
|
|
162158
162292
|
inference_models: "Lists the private AI models and their prices; it pays nothing.",
|
|
162159
162293
|
inference_chat: "Asks an AI model a question, paid privately from your balance.",
|
|
162294
|
+
ask_deepseek_private: "Asks DeepSeek Private a question, paid privately from your balance.",
|
|
162295
|
+
ask_kimi_private: "Asks Kimi Private a question, paid privately from your balance.",
|
|
162160
162296
|
wallet_card_pay: "Pays the price shown on a price card after you click Pay.",
|
|
162161
162297
|
wallet_tor: "Turns on Tor, which hides your IP address, after you say yes."
|
|
162162
162298
|
});
|
|
@@ -162178,6 +162314,7 @@ var init_tools = __esm({
|
|
|
162178
162314
|
});
|
|
162179
162315
|
PROGRESS_EVERY_MS2 = 1e4;
|
|
162180
162316
|
READ_BUDGET_MS = 3e4;
|
|
162317
|
+
ASK_PRIVATE_TOOLS = Object.freeze([["ask_deepseek_private", "DeepSeek"], ["ask_kimi_private", "Kimi"]]);
|
|
162181
162318
|
TOR_WAIT_IN_CALL_MS = 45e3;
|
|
162182
162319
|
TOR_ANSWER_KEEP_MS = 12e4;
|
|
162183
162320
|
UNPAID_TOR_TRY_MS = 12e3;
|
|
@@ -162628,6 +162765,7 @@ var init_tools = __esm({
|
|
|
162628
162765
|
FINALITY_CLOSE_WAIT_MS = 2e4;
|
|
162629
162766
|
POOL_WATCH_MS = 10 * 6e4;
|
|
162630
162767
|
POOL_WATCH_POLL_MS = 2e4;
|
|
162768
|
+
POOL_WATCH_SLOW_MS = 5 * 6e4;
|
|
162631
162769
|
EARLY_BALANCE_DELAY_MS = 50;
|
|
162632
162770
|
FINALITY_SETTLE_WINDOW_SLOTS = 150;
|
|
162633
162771
|
PUBLIC_READ_ANSWER_MS = 3e3;
|
|
@@ -162679,6 +162817,8 @@ var init_tools = __esm({
|
|
|
162679
162817
|
"inference_server",
|
|
162680
162818
|
"inference_models",
|
|
162681
162819
|
"inference_chat",
|
|
162820
|
+
"ask_deepseek_private",
|
|
162821
|
+
"ask_kimi_private",
|
|
162682
162822
|
"wallet_tor"
|
|
162683
162823
|
]);
|
|
162684
162824
|
MCP_HIDDEN_TOOL_NAMES = Object.freeze(["wallet_shield_from_elsewhere", "wallet_unshield_cancel", "wallet_move_status"]);
|
|
@@ -164738,7 +164878,7 @@ var init_stdioServer = __esm({
|
|
|
164738
164878
|
SUPPORTED_PROTOCOL_VERSIONS = Object.freeze(["2025-06-18", "2025-03-26", "2024-11-05"]);
|
|
164739
164879
|
MAX_LINE_BYTES = 4 * 1024 * 1024;
|
|
164740
164880
|
POSITIVE_ATOMIC7 = /^[1-9][0-9]{0,30}$/;
|
|
164741
|
-
INSTRUCTIONS_BASE = `A self-custody Shinjuku Shield wallet on this machine; no tool takes or returns its keys or passphrase. Each answer's say is one plain sentence for the user; other fields are data. Never tell the user a tool, field, code or protocol name (x402, MCP) unless told to. Map a plain request to one tool: "what is my (Shinjuku) balance" -> wallet_balance (starts no new payment or send; it finishes one under way); "add money" / "deposit" / "move USDC in from Phantom or an exchange" -> wallet_add_funds; "get paid" / "pay-me link" -> wallet_pay_me (both: nothing moves until USDC arrives; then wallet_balance makes it private); "was my link paid" -> wallet_pay_me_status; "pay a pay-me link" -> wallet_unshield, to = it; "shield the USDC on this wallet's own address" -> wallet_shield; "stop" / "cancel" -> wallet_cancel (the request_id of what to stop); "pay this URL" -> pay_for_service (no preview needed); "what does this URL cost" -> check_price (only when asked); "find a paid API for X" -> find_paid_services, then pay its url; "send 2 USDC to <address>" -> wallet_unshield; "show my payments" -> wallet_receipts; "sell, swap or send a non-USDC token" -> no tool: say this wallet does not, offer no sale; "which AI models" -> inference_models; "ask
|
|
164881
|
+
INSTRUCTIONS_BASE = `A self-custody Shinjuku Shield wallet on this machine; no tool takes or returns its keys or passphrase. Each answer's say is one plain sentence for the user; other fields are data. Never tell the user a tool, field, code or protocol name (x402, MCP) unless told to. Map a plain request to one tool: "what is my (Shinjuku) balance" -> wallet_balance (starts no new payment or send; it finishes one under way); "add money" / "deposit" / "move USDC in from Phantom or an exchange" -> wallet_add_funds; "get paid" / "pay-me link" -> wallet_pay_me (both: nothing moves until USDC arrives; then wallet_balance makes it private); "was my link paid" -> wallet_pay_me_status; "pay a pay-me link" -> wallet_unshield, to = it; "shield the USDC on this wallet's own address" -> wallet_shield; "stop" / "cancel" -> wallet_cancel (the request_id of what to stop); "pay this URL" -> pay_for_service (no preview needed); "what does this URL cost" -> check_price (only when asked); "find a paid API for X" -> find_paid_services, then pay its url; "send 2 USDC to <address>" -> wallet_unshield; "show my payments" -> wallet_receipts; "sell, swap or send a non-USDC token" -> no tool: say this wallet does not, offer no sale; "which AI models" -> inference_models; "ask <model>" -> ask_<model>_private if listed, else inference_chat; never your own answer; "give my other AI app a private AI" -> inference_server action "start". wallet_balance answers ONE balance (balanceAtomic); pay_for_service pays any paid URL from it. Fields ending in Atomic count 1000000 per USDC; tell the user USDC. The wallet does its own upkeep. A shield, add-funds or unshield call can run for minutes: do as its next says. Pass your own request_id to pay_for_service: the same one never pays twice (a code ending in _retry_same_request: call again with it). pay_for_service never pays above the spending limits (one payment; 24 hours); with none, only the balance bounds it. Never claim a payment happened unless the answer has a transaction. After a pay or send call that stopped, failed, or this app calls rejected or interrupted, call wallet_receipts (a payment) or wallet_cancel (a send; no request_id) before you say whether it happened; never say nothing moved without that. Privacy: the chain does not show which wallet paid, but this app and its model provider see every URL, body, price and answer you handle; reach a seller or its domain only through these tools, never yourself (no curl, browser, DNS or DNS-over-HTTPS lookup), also when the user asks for no Tor: that shows their IP address to the site or a DNS company. When a poolSwitch.items[] item has tellUser true, tell the user its message once, in plain words; the wallet moves the balance itself.`;
|
|
164742
164882
|
OWN_ADDRESS_LINE = '"Send to my (main) wallet": wallet_unshield with no to uses the address saved at setup; never ask for it.';
|
|
164743
164883
|
INSTRUCTIONS = `${INSTRUCTIONS_BASE} ${OWN_ADDRESS_LINE} ${HOST_BLOCKED_LINE}`;
|
|
164744
164884
|
MCP_LOG_LEVELS = Object.freeze(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]);
|
|
@@ -164783,7 +164923,7 @@ parentPort.once("message", () => { for (;;) {
|
|
|
164783
164923
|
};
|
|
164784
164924
|
BUNDLED_SOURCE_DIR = "__bundled_source__";
|
|
164785
164925
|
SHA256_HEX = /^[0-9a-f]{64}$/;
|
|
164786
|
-
UPDATE_NOTICE_TOOLS = Object.freeze(["wallet_balance", "pay_for_service", "inference_chat", "inference_server", "wallet_add_funds"]);
|
|
164926
|
+
UPDATE_NOTICE_TOOLS = Object.freeze(["wallet_balance", "pay_for_service", "inference_chat", "ask_deepseek_private", "ask_kimi_private", "inference_server", "wallet_add_funds"]);
|
|
164787
164927
|
UPDATE_NOTICE_MAX_TEXT = 262144;
|
|
164788
164928
|
UPDATE_RECHECK_MS = 6e4;
|
|
164789
164929
|
NPM_VERSION2 = /^(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})$/;
|
|
@@ -164811,7 +164951,7 @@ parentPort.once("message", () => { for (;;) {
|
|
|
164811
164951
|
};
|
|
164812
164952
|
TOOL_ROOTS_WAIT_MS = 6e4;
|
|
164813
164953
|
ADOPTER_ROOTS_CHECK_MS = 15e3;
|
|
164814
|
-
ROOTS_FREE_TOOLS = /* @__PURE__ */ new Set(["pay_for_service", "inference_chat", "inference_models", "inference_server", "check_price", "find_paid_services"]);
|
|
164954
|
+
ROOTS_FREE_TOOLS = /* @__PURE__ */ new Set(["pay_for_service", "inference_chat", "ask_deepseek_private", "ask_kimi_private", "inference_models", "inference_server", "check_price", "find_paid_services"]);
|
|
164815
164955
|
ROOTS_READ_TOOLS = /* @__PURE__ */ new Set(["wallet_balance", "wallet_receipts", "wallet_backup"]);
|
|
164816
164956
|
MCP_CLOSE_BOUND_MS = 5e3;
|
|
164817
164957
|
MCP_CLOSE_HISTORY_BOUND_MS = 17e3;
|
|
@@ -167735,6 +167875,130 @@ function homeScreenNeeds() {
|
|
|
167735
167875
|
}
|
|
167736
167876
|
return { columns: MIN_COLUMNS, rows: 80 };
|
|
167737
167877
|
}
|
|
167878
|
+
function jobLine(title, stream, env) {
|
|
167879
|
+
const codes = paletteFor(screenColor(stream, env));
|
|
167880
|
+
const classes = ["crim", "bone", "ash", "verm"];
|
|
167881
|
+
return [...JOB_LINE_WORDS, clean4(title)].map((text3, index) => codes ? `${codes[classes[index]]}${text3}${RESET2}` : text3).join("");
|
|
167882
|
+
}
|
|
167883
|
+
function sizeNow(stream) {
|
|
167884
|
+
try {
|
|
167885
|
+
const size = [0, 0];
|
|
167886
|
+
if (!stream._handle.getWindowSize(size) && size[0] > 0 && size[1] > 0) return { columns: size[0], rows: size[1] };
|
|
167887
|
+
} catch {
|
|
167888
|
+
}
|
|
167889
|
+
return { columns: stream.columns, rows: stream.rows };
|
|
167890
|
+
}
|
|
167891
|
+
function jobBarPin(title, stream, env) {
|
|
167892
|
+
const size = sizeNow(stream);
|
|
167893
|
+
if (!holdsJobBar(size.rows, size.columns, clean4(title))) return "";
|
|
167894
|
+
const { rows: rows2 } = size;
|
|
167895
|
+
const columns = Number.isSafeInteger(size.columns) ? size.columns : 80;
|
|
167896
|
+
const codes = paletteFor(screenColor(stream, env));
|
|
167897
|
+
const line = "\u2500".repeat(columns - 1);
|
|
167898
|
+
return `\x1B7\x1B[r\x1B8\x1BD\x1BD\x1B[2A\x1B7\x1B[1B\r\x1B[J\x1B[${rows2 - 1};1H${codes ? `${codes.ash}${line}${RESET2}` : line}\x1B[${rows2};1H${jobLine(title, stream, env)}\x1B[1;${rows2 - JOB_BAR_ROWS}r\x1B8`;
|
|
167899
|
+
}
|
|
167900
|
+
function keepJobBar({ title, stdout = process.stdout, stderr = process.stderr, env = process.env } = {}) {
|
|
167901
|
+
const name = title ?? env?.[JOB_BAR_ENV];
|
|
167902
|
+
if (!name) return () => {
|
|
167903
|
+
};
|
|
167904
|
+
const undo = [.../* @__PURE__ */ new Set([stdout, stderr])].filter((stream) => stream?.isTTY).map((stream) => {
|
|
167905
|
+
const before = stream.write;
|
|
167906
|
+
let on = true;
|
|
167907
|
+
let tail = "";
|
|
167908
|
+
let owed = false;
|
|
167909
|
+
const barWrite = function barWrite2(chunk, ...rest) {
|
|
167910
|
+
const result = before.call(stream, chunk, ...rest);
|
|
167911
|
+
if (!on) return result;
|
|
167912
|
+
const text3 = tail + (typeof chunk === "string" ? chunk : chunk instanceof Uint8Array ? Buffer.from(chunk).toString("latin1") : "");
|
|
167913
|
+
tail = ERASE_START.exec(text3)?.[0] ?? "";
|
|
167914
|
+
owed = owed || ERASE_DISPLAY.test(text3);
|
|
167915
|
+
if (!owed || ESCAPE_OPEN.test(text3)) return result;
|
|
167916
|
+
owed = false;
|
|
167917
|
+
const pin = jobBarPin(name, stream, env);
|
|
167918
|
+
if (pin) {
|
|
167919
|
+
try {
|
|
167920
|
+
before.call(stream, pin);
|
|
167921
|
+
} catch {
|
|
167922
|
+
}
|
|
167923
|
+
}
|
|
167924
|
+
return result;
|
|
167925
|
+
};
|
|
167926
|
+
stream.write = barWrite;
|
|
167927
|
+
return () => {
|
|
167928
|
+
on = false;
|
|
167929
|
+
if (stream.write === barWrite) stream.write = before;
|
|
167930
|
+
};
|
|
167931
|
+
});
|
|
167932
|
+
return () => undo.forEach((off) => off());
|
|
167933
|
+
}
|
|
167934
|
+
function holdJobBar({ title, stdout = process.stdout, env = process.env, proc = process } = {}) {
|
|
167935
|
+
const write = (text3) => {
|
|
167936
|
+
try {
|
|
167937
|
+
stdout.write(text3);
|
|
167938
|
+
} catch {
|
|
167939
|
+
}
|
|
167940
|
+
};
|
|
167941
|
+
env[JOB_BAR_ENV] = clean4(title);
|
|
167942
|
+
let held2 = true;
|
|
167943
|
+
let pinned = false;
|
|
167944
|
+
const pin = () => {
|
|
167945
|
+
const text3 = jobBarPin(title, stdout, env);
|
|
167946
|
+
if (!text3) return false;
|
|
167947
|
+
write(text3);
|
|
167948
|
+
pinned = true;
|
|
167949
|
+
return true;
|
|
167950
|
+
};
|
|
167951
|
+
const unpin = () => {
|
|
167952
|
+
if (!pinned) return;
|
|
167953
|
+
pinned = false;
|
|
167954
|
+
write("\x1B7\x1B[r\x1B8\x1BD\x1B7\r\x1B[J\x1B8\x1B[1A");
|
|
167955
|
+
};
|
|
167956
|
+
const onResize = () => {
|
|
167957
|
+
if (!pin()) unpin();
|
|
167958
|
+
};
|
|
167959
|
+
const stopSignals = ["SIGTERM", "SIGHUP"];
|
|
167960
|
+
const onStop = (signal) => {
|
|
167961
|
+
release();
|
|
167962
|
+
if (proc.listenerCount?.(signal) === 0) {
|
|
167963
|
+
try {
|
|
167964
|
+
proc.kill(proc.pid, signal);
|
|
167965
|
+
} catch {
|
|
167966
|
+
}
|
|
167967
|
+
}
|
|
167968
|
+
};
|
|
167969
|
+
pin();
|
|
167970
|
+
const dropHook = keepJobBar({ title, stdout, env });
|
|
167971
|
+
const sizeCheck = setInterval(() => {
|
|
167972
|
+
const now = sizeNow(stdout);
|
|
167973
|
+
if (now.rows === stdout.rows && now.columns === stdout.columns) return;
|
|
167974
|
+
try {
|
|
167975
|
+
stdout._refreshSize();
|
|
167976
|
+
} catch {
|
|
167977
|
+
}
|
|
167978
|
+
}, JOB_BAR_SIZE_CHECK_MS);
|
|
167979
|
+
sizeCheck.unref?.();
|
|
167980
|
+
try {
|
|
167981
|
+
stdout.on?.("resize", onResize);
|
|
167982
|
+
proc.once?.("exit", release);
|
|
167983
|
+
for (const signal of stopSignals) proc.on?.(signal, onStop);
|
|
167984
|
+
} catch {
|
|
167985
|
+
}
|
|
167986
|
+
function release() {
|
|
167987
|
+
if (!held2) return;
|
|
167988
|
+
held2 = false;
|
|
167989
|
+
clearInterval(sizeCheck);
|
|
167990
|
+
dropHook();
|
|
167991
|
+
unpin();
|
|
167992
|
+
delete env[JOB_BAR_ENV];
|
|
167993
|
+
try {
|
|
167994
|
+
stdout.removeListener?.("resize", onResize);
|
|
167995
|
+
proc.removeListener?.("exit", release);
|
|
167996
|
+
for (const signal of stopSignals) proc.removeListener?.(signal, onStop);
|
|
167997
|
+
} catch {
|
|
167998
|
+
}
|
|
167999
|
+
}
|
|
168000
|
+
return release;
|
|
168001
|
+
}
|
|
167738
168002
|
async function runJobView({
|
|
167739
168003
|
title,
|
|
167740
168004
|
run: run2,
|
|
@@ -167742,7 +168006,9 @@ async function runJobView({
|
|
|
167742
168006
|
stdin = process.stdin,
|
|
167743
168007
|
env = process.env,
|
|
167744
168008
|
launcherGone = launcherWatch(),
|
|
167745
|
-
platform = process.platform
|
|
168009
|
+
platform = process.platform,
|
|
168010
|
+
pinLine = true,
|
|
168011
|
+
proc = process
|
|
167746
168012
|
} = {}) {
|
|
167747
168013
|
const codes = paletteFor(screenColor(stdout, env));
|
|
167748
168014
|
const paint2 = (parts2) => parts2.map(([text3, cls]) => codes && cls ? `${codes[cls]}${text3}${RESET2}` : text3).join("");
|
|
@@ -167752,12 +168018,16 @@ async function runJobView({
|
|
|
167752
168018
|
} catch {
|
|
167753
168019
|
}
|
|
167754
168020
|
};
|
|
167755
|
-
const width = Math.max(20, (stdout.columns || 80) - 1);
|
|
167756
|
-
const rule = paint2([["\u2500".repeat(width), "ash"]]);
|
|
167757
|
-
write(`\x1B[0m\x1B[2J\x1B[H${
|
|
167758
|
-
${rule}
|
|
168021
|
+
const width = () => Math.max(20, (stdout.columns || 80) - 1);
|
|
168022
|
+
const rule = () => paint2([["\u2500".repeat(width()), "ash"]]);
|
|
168023
|
+
write(`\x1B[0m\x1B[2J\x1B[H${jobLine(title, stdout, env)}
|
|
168024
|
+
${rule()}
|
|
167759
168025
|
|
|
167760
168026
|
`);
|
|
168027
|
+
const canPin = pinLine && Boolean(stdout.isTTY);
|
|
168028
|
+
if (!canPin) delete env[JOB_BAR_ENV];
|
|
168029
|
+
const release = canPin ? holdJobBar({ title, stdout, env, proc }) : () => {
|
|
168030
|
+
};
|
|
167761
168031
|
let code2;
|
|
167762
168032
|
let endWords;
|
|
167763
168033
|
try {
|
|
@@ -167776,21 +168046,25 @@ ${rule}
|
|
|
167776
168046
|
}
|
|
167777
168047
|
};
|
|
167778
168048
|
const shellAgain = (first) => write(`${first ? `
|
|
167779
|
-
${"\u2500".repeat(width)}
|
|
168049
|
+
${"\u2500".repeat(width())}
|
|
167780
168050
|
${end2.map(([text3]) => text3).join("")}
|
|
167781
168051
|
` : ""}The wallet screen has closed: the command that started it ended with the Ctrl+C.
|
|
167782
168052
|
` + (platform === "win32" ? 'If this window asks "Terminate batch job (Y/N)?", type Y and press Enter. ' : "") + "To open the wallet again, run the same command.\n");
|
|
167783
168053
|
if (gone()) {
|
|
168054
|
+
release();
|
|
167784
168055
|
shellAgain(true);
|
|
167785
168056
|
return { code: code2, next: "quit", launcherGone: true };
|
|
167786
168057
|
}
|
|
167787
168058
|
write(`
|
|
167788
|
-
${rule}
|
|
168059
|
+
${rule()}
|
|
167789
168060
|
${paint2(end2)}
|
|
167790
168061
|
${paint2([["press a job key, such as [l], to open that job at once", "bone"]])}
|
|
167791
168062
|
${paint2([["any other key, [q] too, goes back to the home screen", "mute"]])}
|
|
167792
168063
|
`);
|
|
167793
|
-
if (!stdin?.isTTY || typeof stdin.setRawMode !== "function")
|
|
168064
|
+
if (!stdin?.isTTY || typeof stdin.setRawMode !== "function") {
|
|
168065
|
+
release();
|
|
168066
|
+
return { code: code2, next: "quit" };
|
|
168067
|
+
}
|
|
167794
168068
|
const rawBefore = Boolean(stdin.isRaw);
|
|
167795
168069
|
let key;
|
|
167796
168070
|
let ended2 = false;
|
|
@@ -167817,6 +168091,7 @@ ${paint2([["any other key, [q] too, goes back to the home screen", "mute"]])}
|
|
|
167817
168091
|
stdin.setRawMode(rawBefore);
|
|
167818
168092
|
} catch {
|
|
167819
168093
|
}
|
|
168094
|
+
release();
|
|
167820
168095
|
}
|
|
167821
168096
|
if (ended2) {
|
|
167822
168097
|
shellAgain(false);
|
|
@@ -167845,17 +168120,16 @@ async function waitForRoom({ stdout = process.stdout, stdin = process.stdin, env
|
|
|
167845
168120
|
} catch {
|
|
167846
168121
|
}
|
|
167847
168122
|
};
|
|
167848
|
-
const
|
|
167849
|
-
|
|
167850
|
-
|
|
167851
|
-
})();
|
|
168123
|
+
const codes = paletteFor(screenColor(stdout, env));
|
|
168124
|
+
const tint = (name, text3) => codes ? `${codes[name]}${text3}\x1B[0m` : text3;
|
|
168125
|
+
const mark = codes ? `${codes.crim}\u25C6 ${codes.bone}shinjuku-shield\x1B[0m` : "\u25C6 shinjuku-shield";
|
|
167852
168126
|
const say2 = () => write([
|
|
167853
168127
|
"\x1B[0m\x1B[2J\x1B[H",
|
|
167854
168128
|
mark,
|
|
167855
|
-
"This window is too small for the wallet screen.",
|
|
167856
|
-
`It needs ${needs.columns} x ${needs.rows}; this one is ${stdout.columns} x ${stdout.rows}
|
|
167857
|
-
"Make the window larger: the screen opens by itself.",
|
|
167858
|
-
"Press q to stop.",
|
|
168129
|
+
tint("bone", "This window is too small for the wallet screen."),
|
|
168130
|
+
tint("dim", `It needs ${needs.columns} x ${needs.rows}; this one is ${stdout.columns} x ${stdout.rows}.`),
|
|
168131
|
+
tint("dim", "Make the window larger: the screen opens by itself."),
|
|
168132
|
+
tint("mute", "Press q to stop."),
|
|
167859
168133
|
""
|
|
167860
168134
|
].join("\n"));
|
|
167861
168135
|
say2();
|
|
@@ -167890,7 +168164,7 @@ async function waitForRoom({ stdout = process.stdout, stdin = process.stdin, env
|
|
|
167890
168164
|
}
|
|
167891
168165
|
}
|
|
167892
168166
|
}
|
|
167893
|
-
var MIN_COLUMNS, WIDE_COLUMNS, WIDE_WIDTH, LEFT_X, LEFT_WIDTH, PANEL_X, PANEL_WIDTH, TOP, BAND_MS, BAND_CHANCE, KATAKANA, FONT, AGENT_KEY, HELP_KEY, QUIT_KEY, KEY_HELP, lettersOf, PANELS, ALL_PIECES, KEYS_LINE, FIRST_LINES, SETUP_KEY, RESTORE_KEY, END_KEYS, RESTORE_STEP, HINT, tooSmallLines, COLORS, COLORS_16, RESET2, DATA_SYMBOLS, HOME_SHAPE, FIRST_SHAPE, WIDE, WORD_TOP, WORD_BOTTOM, WORD_WIDTH, ROMAJI, BIG_MARK, SMALL_MARK, LOCKUP_GAP, LOCKUP_WIDTH, Screen, setupLine, randomKatakana, MARK_TONES, PUBLIC_STEP, stackHeight, LAUNCHER_POLL_MS, LAUNCHER_AT_LOAD, PARENT_AT_LOAD;
|
|
168167
|
+
var MIN_COLUMNS, WIDE_COLUMNS, WIDE_WIDTH, LEFT_X, LEFT_WIDTH, PANEL_X, PANEL_WIDTH, TOP, BAND_MS, BAND_CHANCE, KATAKANA, FONT, AGENT_KEY, HELP_KEY, QUIT_KEY, KEY_HELP, lettersOf, PANELS, ALL_PIECES, KEYS_LINE, FIRST_LINES, SETUP_KEY, RESTORE_KEY, END_KEYS, RESTORE_STEP, HINT, tooSmallLines, COLORS, COLORS_16, RESET2, DATA_SYMBOLS, HOME_SHAPE, FIRST_SHAPE, WIDE, WORD_TOP, WORD_BOTTOM, WORD_WIDTH, ROMAJI, BIG_MARK, SMALL_MARK, LOCKUP_GAP, LOCKUP_WIDTH, Screen, setupLine, randomKatakana, MARK_TONES, PUBLIC_STEP, stackHeight, JOB_BAR_SIZE_CHECK_MS, ERASE_DISPLAY, ERASE_START, ESCAPE_OPEN, LAUNCHER_POLL_MS, LAUNCHER_AT_LOAD, PARENT_AT_LOAD;
|
|
167894
168168
|
var init_homeScreen = __esm({
|
|
167895
168169
|
"wallet/src/cli/homeScreen.mjs"() {
|
|
167896
168170
|
"use strict";
|
|
@@ -168061,6 +168335,10 @@ var init_homeScreen = __esm({
|
|
|
168061
168335
|
"below-least": "the least that can be made private is 0.01 USDC."
|
|
168062
168336
|
};
|
|
168063
168337
|
stackHeight = (blocks) => blocks.reduce((sum2, block) => sum2 + block.height, 0) + blocks.length - 1;
|
|
168338
|
+
JOB_BAR_SIZE_CHECK_MS = 500;
|
|
168339
|
+
ERASE_DISPLAY = /\x1b\[[0-3]?J/;
|
|
168340
|
+
ERASE_START = /\x1b(?:\[[0-3]?)?$/;
|
|
168341
|
+
ESCAPE_OPEN = /\x1b(?:\[[0-?]*[ -/]*|\][^\x07\x1b]*)?$/;
|
|
168064
168342
|
LAUNCHER_POLL_MS = 250;
|
|
168065
168343
|
LAUNCHER_AT_LOAD = /^[0-9]+$/.test(process.env[LAUNCHER_PID_ENV] ?? "") ? Number(process.env[LAUNCHER_PID_ENV]) : process.ppid;
|
|
168066
168344
|
PARENT_AT_LOAD = process.ppid;
|
|
@@ -176483,7 +176761,7 @@ function showDepositQr(ctx, waiting) {
|
|
|
176483
176761
|
if (typeof owner !== "string" || ctx.qrShown.has(owner)) continue;
|
|
176484
176762
|
ctx.qrShown.add(owner);
|
|
176485
176763
|
const link3 = payMeUri({ owner, mint: store.state.asset, decimals: Number(store.state.decimals ?? 6), amountAtomic: part.amountAtomic });
|
|
176486
|
-
const rows2 = Number.isSafeInteger(process.stderr.rows) ? process.stderr.rows : void 0;
|
|
176764
|
+
const rows2 = Number.isSafeInteger(process.stderr.rows) ? jobRows(process.stderr.rows, process.env, process.stderr.columns) : void 0;
|
|
176487
176765
|
const qr = qrTerminalText(qrLinkText(link3), rows2 !== void 0 ? { maxLines: rows2 - 7 } : {});
|
|
176488
176766
|
const lines = [`Scan with your phone wallet (Solana Pay, USDC)${waiting.length > 1 ? `, ${usdc4(part.amountAtomic)} USDC to ${owner}` : ""}:`, qr, link3];
|
|
176489
176767
|
ctx.io.err(`${lines.join("\n")}
|
|
@@ -183975,7 +184253,7 @@ function commandPathFix(deps, npmVersion, balanceLine2 = oneTimeCommandLine("bal
|
|
|
183975
184253
|
`);
|
|
183976
184254
|
}
|
|
183977
184255
|
if ((step.state === "profile-added" || step.state === "profile-present") && !String(process.env.PATH ?? "").split(":").includes(step.folder)) {
|
|
183978
|
-
process.env.PATH = `${
|
|
184256
|
+
process.env.PATH = `${process.env.PATH ?? ""}:${step.folder}`;
|
|
183979
184257
|
refreshCommandName();
|
|
183980
184258
|
}
|
|
183981
184259
|
return step;
|
|
@@ -184038,6 +184316,7 @@ ${result.error.message}` : ""}` };
|
|
|
184038
184316
|
function commandUseLines(npmVersion) {
|
|
184039
184317
|
if (!commandOnPath()) return terminalUseLinesHere(npmVersion);
|
|
184040
184318
|
const older = npmVersion ? olderInstalledCommand(npmVersion) : void 0;
|
|
184319
|
+
if (!older && thisWindowLines("help").length) return thisWindowLines("help");
|
|
184041
184320
|
if (!older) return [`In a terminal, run ${CLI_TYPED} help to see every command.`];
|
|
184042
184321
|
return [`The shinjuku command on this computer is version ${older.installed}; this wallet is version ${older.current}. To update the command${older.plain ? " to the newest stable version" : ""}, run${older.plain ? "" : " this (it asks before it updates the command)"}:`, ` ${older.line}`];
|
|
184043
184322
|
}
|
|
@@ -184211,7 +184490,7 @@ async function runSetupCommandHeld(values, deps) {
|
|
|
184211
184490
|
noLimitNote = true;
|
|
184212
184491
|
}
|
|
184213
184492
|
if (rescued.tor === void 0 && !values.has("--prefer-tor") && !torRunRecords) {
|
|
184214
|
-
const torHow = (deps.platform ?? process.platform)
|
|
184493
|
+
const torHow = ownTorPlatform(deps.platform ?? process.platform) ? "the wallet gets Tor and runs it in the background for you (only if that fails, setup gives a command)" : "if Tor is not running, setup gives the one command that starts it";
|
|
184215
184494
|
const tor = String(await deps.ask(`Send every request through Tor? It hides your IP address; ${torHow}. [Y/n] `)).trim();
|
|
184216
184495
|
options.tor = !/^n(o)?$/i.test(tor);
|
|
184217
184496
|
}
|
|
@@ -187588,7 +187867,7 @@ async function runPayMe(values, deps, io) {
|
|
|
187588
187867
|
`);
|
|
187589
187868
|
return;
|
|
187590
187869
|
}
|
|
187591
|
-
const rows2 = Number.isSafeInteger(process.stdout.rows) ? process.stdout.rows : void 0;
|
|
187870
|
+
const rows2 = Number.isSafeInteger(process.stdout.rows) ? jobRows(process.stdout.rows, deps.env, process.stdout.columns) : void 0;
|
|
187592
187871
|
io.out([
|
|
187593
187872
|
`Your pay-me link${view2.amount ? ` for ${view2.amount} USDC` : ""}. Send it to the person who pays you:`,
|
|
187594
187873
|
"",
|
|
@@ -189720,7 +189999,13 @@ function defaultDependencies() {
|
|
|
189720
189999
|
process.on("SIGINT", ignore);
|
|
189721
190000
|
let child;
|
|
189722
190001
|
try {
|
|
189723
|
-
|
|
190002
|
+
const { [JOB_BAR_ENV]: left, ...childEnv } = env;
|
|
190003
|
+
const bar = process.env[JOB_BAR_ENV];
|
|
190004
|
+
child = spawn13(
|
|
190005
|
+
process.execPath,
|
|
190006
|
+
[...process.execArgv, cliEntry2, ...args],
|
|
190007
|
+
{ stdio: "inherit", env: { ...childEnv, [HOME_JOB_ENV]: "1", ...bar ? { [JOB_BAR_ENV]: bar } : {} } }
|
|
190008
|
+
);
|
|
189724
190009
|
} catch {
|
|
189725
190010
|
process.removeListener("SIGINT", ignore);
|
|
189726
190011
|
done(1);
|
|
@@ -189735,8 +190020,11 @@ function defaultDependencies() {
|
|
|
189735
190020
|
done(code2 === 3221225786 || code2 === -1073741510 ? 130 : code2 ?? (signal ? 130 : 1));
|
|
189736
190021
|
});
|
|
189737
190022
|
}),
|
|
189738
|
-
/**
|
|
189739
|
-
|
|
190023
|
+
/**
|
|
190024
|
+
* A home key's job view (cli/homeScreen.mjs runJobView): { code, next: "back" | "quit" }. Its Shinjuku line holds
|
|
190025
|
+
* the bottom of the window while the job's text scrolls above it (pinLine).
|
|
190026
|
+
*/
|
|
190027
|
+
homeJobView: (title, run2, { pinLine } = {}) => runJobView({ title, run: run2, pinLine }),
|
|
189740
190028
|
/** A window too small for the screen: "room" when it grew enough, "quit" (q), "off" (no terminal keys). */
|
|
189741
190029
|
homeWaitForRoom: (env) => waitForRoom({ env }),
|
|
189742
190030
|
/** The home screen's [o] and [b] keys show only when this build has their jobs (homeScreen.mjs homeKeys). */
|
|
@@ -190139,9 +190427,10 @@ async function homeKeyJob(key, { data, argv: argv2, deps }) {
|
|
|
190139
190427
|
if (key !== "c") return 0;
|
|
190140
190428
|
const hostNames = HOST_NAMES;
|
|
190141
190429
|
const other = HOST_TARGETS.length + 1;
|
|
190430
|
+
const numbered = (number2) => String(number2).padStart(String(other).length);
|
|
190142
190431
|
io.err(`Which agent app gets the wallet?
|
|
190143
|
-
${HOST_TARGETS.map((host, index) => ` ${index + 1} ${hostNames[host] ?? host}`).join("\n")}
|
|
190144
|
-
${other} another app (not in this list)
|
|
190432
|
+
${HOST_TARGETS.map((host, index) => ` ${numbered(index + 1)} ${hostNames[host] ?? host}`).join("\n")}
|
|
190433
|
+
${numbered(other)} another app (not in this list)
|
|
190145
190434
|
`);
|
|
190146
190435
|
for (; ; ) {
|
|
190147
190436
|
const answer = String(await deps.ask(`Type its number (1 to ${other}), or press Enter to stop: `)).trim();
|
|
@@ -190171,7 +190460,7 @@ ${HOST_TARGETS.map((host, index) => ` ${index + 1} ${hostNames[host] ?? host}`
|
|
|
190171
190460
|
const home = setupHome(deps.env);
|
|
190172
190461
|
const npmVersion = deps.walletVersion().npm;
|
|
190173
190462
|
const hosts = await addToHosts([host], home, deps, { npmVersion, ask: deps.stdinIsTTY() ? deps.ask : void 0 });
|
|
190174
|
-
if (hosts.kept.has(host)) return 0;
|
|
190463
|
+
if (hosts.kept.has(host)) return { code: 0, ended: "nothing was changed" };
|
|
190175
190464
|
if (hosts.added.has(host)) {
|
|
190176
190465
|
io.out(`Next: ask ${hostNames[host]} "what is my Shinjuku balance".
|
|
190177
190466
|
`);
|
|
@@ -190196,15 +190485,19 @@ ${HOST_TARGETS.map((host, index) => ` ${index + 1} ${hostNames[host] ?? host}`
|
|
|
190196
190485
|
return 130;
|
|
190197
190486
|
}
|
|
190198
190487
|
}
|
|
190488
|
+
var SETUP_TITLE = "set up the wallet";
|
|
190199
190489
|
function setupThemeFor(values, deps) {
|
|
190200
190490
|
if (!setupThemeOn({ env: deps.env, interactive: !values.has("--yes"), stdinIsTTY: deps.stdinIsTTY() })) return void 0;
|
|
190201
190491
|
const paint2 = setupPainter({ env: deps.env });
|
|
190202
190492
|
const top = !values.has("--yes") && deps.env[SETUP_THEME_ENV] !== "1" && deps.env[HOME_JOB_ENV] !== "1";
|
|
190493
|
+
let dropBar = () => {
|
|
190494
|
+
};
|
|
190203
190495
|
if (top) {
|
|
190204
|
-
deps.io.out(setupHeader(paint2, process.stdout.columns));
|
|
190496
|
+
deps.io.out(setupHeader(paint2, process.stdout.columns, SETUP_TITLE));
|
|
190205
190497
|
deps.env[SETUP_THEME_ENV] = "1";
|
|
190498
|
+
if (process.stdout.isTTY) dropBar = holdJobBar({ title: SETUP_TITLE, env: deps.env });
|
|
190206
190499
|
}
|
|
190207
|
-
return { io: themedIo(deps.io, paint2), ask: themedAsk(deps.ask, paint2), paint: paint2, top };
|
|
190500
|
+
return { io: themedIo(deps.io, paint2), ask: themedAsk(deps.ask, paint2), paint: paint2, top, dropBar };
|
|
190208
190501
|
}
|
|
190209
190502
|
async function openShinjukuAfterSetup(argv2, deps, theme2) {
|
|
190210
190503
|
delete deps.env[SETUP_THEME_ENV];
|
|
@@ -190218,15 +190511,29 @@ async function openShinjukuAfterSetup(argv2, deps, theme2) {
|
|
|
190218
190511
|
theme2.io.out("\n");
|
|
190219
190512
|
}
|
|
190220
190513
|
if (/^n(o)?$/i.test(answer)) {
|
|
190221
|
-
|
|
190514
|
+
const here4 = thisWindowLines();
|
|
190515
|
+
theme2.io.out(here4.length ? `To open Shinjuku later:
|
|
190516
|
+
${here4.join("\n")}
|
|
190517
|
+
` : `To open Shinjuku later, type:
|
|
190222
190518
|
${cli4()}
|
|
190223
190519
|
`);
|
|
190520
|
+
theme2.dropBar();
|
|
190224
190521
|
return 0;
|
|
190225
190522
|
}
|
|
190523
|
+
theme2.dropBar();
|
|
190226
190524
|
const connection = argv2.flatMap((word2, index) => word2 === "--tor" || word2 === "--no-tor" ? [word2] : word2 === "--proxy" && argv2[index + 1] ? [word2, argv2[index + 1]] : []);
|
|
190227
|
-
return runHomeLoop(connection, deps, { animation: false });
|
|
190525
|
+
return runHomeLoop(connection, deps, { animation: false, drawn: true });
|
|
190228
190526
|
}
|
|
190229
|
-
async function runHomeLoop(argv2, deps, { animation = true } = {}) {
|
|
190527
|
+
async function runHomeLoop(argv2, deps, { animation = true, drawn = false } = {}) {
|
|
190528
|
+
const unTheme = drawn || !terminalThemeOn({ env: deps.env }) ? () => {
|
|
190529
|
+
} : themeStreams(setupPainter({ env: deps.env }));
|
|
190530
|
+
try {
|
|
190531
|
+
return await homeLoop(argv2, deps, { animation });
|
|
190532
|
+
} finally {
|
|
190533
|
+
unTheme();
|
|
190534
|
+
}
|
|
190535
|
+
}
|
|
190536
|
+
async function homeLoop(argv2, deps, { animation }) {
|
|
190230
190537
|
const io = deps.io;
|
|
190231
190538
|
if (!deps.homeScreenOn(deps.env)) {
|
|
190232
190539
|
const room = deps.stdinIsTTY() && process.stdout.isTTY ? await deps.homeWaitForRoom(deps.env) : "off";
|
|
@@ -190236,6 +190543,7 @@ async function runHomeLoop(argv2, deps, { animation = true } = {}) {
|
|
|
190236
190543
|
return 0;
|
|
190237
190544
|
}
|
|
190238
190545
|
}
|
|
190546
|
+
if (typeof deps.ask === "function") deps.ask = themedAsk(deps.ask, setupPainter({ env: deps.env }));
|
|
190239
190547
|
const readData = () => ({
|
|
190240
190548
|
...deps.homeData({ env: deps.env, walletVersion: deps.walletVersion, torRun: homeJobTor(argv2, deps.env) }),
|
|
190241
190549
|
...deps.homeKeysExtra(deps.env)
|
|
@@ -190279,7 +190587,13 @@ async function runHomeLoop(argv2, deps, { animation = true } = {}) {
|
|
|
190279
190587
|
await balanceRead?.finish(io);
|
|
190280
190588
|
ranJob = true;
|
|
190281
190589
|
const shown = facts.current();
|
|
190282
|
-
const view2 = await deps.homeJobView(
|
|
190590
|
+
const view2 = await deps.homeJobView(
|
|
190591
|
+
HOME_JOB_TITLES[screen.key] ?? "wallet",
|
|
190592
|
+
() => homeKeyJob(screen.key, { data: shown, argv: argv2, deps }),
|
|
190593
|
+
// session-made, compet, 2026-11-20: the private chat draws its own hint row under the cursor (inference/chat.mjs);
|
|
190594
|
+
// it was not looked at with the held rows, so it runs without them.
|
|
190595
|
+
{ pinLine: screen.key !== "t" }
|
|
190596
|
+
);
|
|
190283
190597
|
if (screen.key === "i") localAi.forget();
|
|
190284
190598
|
if (view2.next === "quit") return view2.code === 130 ? 130 : 0;
|
|
190285
190599
|
nextKey = view2.key;
|
|
@@ -190300,6 +190614,10 @@ async function runShinjukuWallet(argv2, overrides = {}) {
|
|
|
190300
190614
|
const themed = endsProcess && themedCommand(name, args) && terminalThemeOn({ stdout: stream, env: deps.env });
|
|
190301
190615
|
const unTheme = themed ? themeStreams(setupPainter({ stdout: stream, env: deps.env }), dataOut ? [process.stderr] : void 0) : () => {
|
|
190302
190616
|
};
|
|
190617
|
+
const heldByParent = endsProcess && (inHomeJob(deps.env) || deps.env[SETUP_THEME_ENV] === "1");
|
|
190618
|
+
if (endsProcess && !heldByParent) delete deps.env[JOB_BAR_ENV];
|
|
190619
|
+
const dropBar = heldByParent ? keepJobBar({ env: deps.env }) : () => {
|
|
190620
|
+
};
|
|
190303
190621
|
const designOut = dataOut ? io.err : io.out;
|
|
190304
190622
|
const topRun = themed && deps.env[THEME_CHILD_ENV] !== "1" && deps.env[HOME_JOB_ENV] !== "1";
|
|
190305
190623
|
const ownTop = topRun && !(name === "setup" && !args.includes("--yes"));
|
|
@@ -190312,6 +190630,7 @@ async function runShinjukuWallet(argv2, overrides = {}) {
|
|
|
190312
190630
|
return await runCommandLine(argv2, deps, { name, args, endsProcess });
|
|
190313
190631
|
} finally {
|
|
190314
190632
|
if (ownTop) designOut(commandFooter(stream.columns, { stream, env: deps.env }));
|
|
190633
|
+
dropBar();
|
|
190315
190634
|
unTheme();
|
|
190316
190635
|
}
|
|
190317
190636
|
}
|