@toon-protocol/townhouse 0.1.1 → 0.1.2
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 +95 -438
- package/dist/cli.js +63 -11
- package/dist/cli.js.map +1 -1
- package/dist/compose/townhouse-hs.yml +8 -8
- package/dist/image-manifest.json +10 -10
- package/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -46,7 +46,8 @@ import {
|
|
|
46
46
|
existsSync,
|
|
47
47
|
renameSync,
|
|
48
48
|
rmSync,
|
|
49
|
-
statSync
|
|
49
|
+
statSync,
|
|
50
|
+
realpathSync
|
|
50
51
|
} from "fs";
|
|
51
52
|
import { join, resolve, dirname } from "path";
|
|
52
53
|
import { homedir } from "os";
|
|
@@ -2026,6 +2027,18 @@ Flags:
|
|
|
2026
2027
|
If no flags given, starts all enabled nodes from config.`;
|
|
2027
2028
|
var DEFAULT_CONFIG_DIR = join(homedir(), ".townhouse");
|
|
2028
2029
|
var DEFAULT_CONFIG_PATH = join(DEFAULT_CONFIG_DIR, "config.yaml");
|
|
2030
|
+
function printInitNextStep(dir) {
|
|
2031
|
+
const isDefaultDir = dir === resolve(DEFAULT_CONFIG_DIR);
|
|
2032
|
+
const cmd = isDefaultDir ? "npx @toon-protocol/townhouse hs up" : `npx @toon-protocol/townhouse hs up -c ${join(dir, "config.yaml")}`;
|
|
2033
|
+
console.log("");
|
|
2034
|
+
console.log("Next \u2014 start your node:");
|
|
2035
|
+
console.log(` ${cmd}`);
|
|
2036
|
+
console.log("");
|
|
2037
|
+
console.log(
|
|
2038
|
+
"First run pulls container images and bootstraps a hidden service."
|
|
2039
|
+
);
|
|
2040
|
+
console.log("It can take a few minutes; progress is shown throughout.");
|
|
2041
|
+
}
|
|
2029
2042
|
async function handleInit(force, configDir, password, preset, yes) {
|
|
2030
2043
|
const dir = resolve(configDir ?? DEFAULT_CONFIG_DIR);
|
|
2031
2044
|
const configPath = join(dir, "config.yaml");
|
|
@@ -2059,9 +2072,17 @@ async function handleInit(force, configDir, password, preset, yes) {
|
|
|
2059
2072
|
console.log(`Config created at ${configPath}`);
|
|
2060
2073
|
const walletPath = join(dir, "wallet.enc");
|
|
2061
2074
|
if (existsSync(walletPath) && !force) {
|
|
2075
|
+
console.log("");
|
|
2076
|
+
console.log(
|
|
2077
|
+
`Wallet already exists at ${walletPath} \u2014 keeping your existing keys.`
|
|
2078
|
+
);
|
|
2062
2079
|
console.log(
|
|
2063
|
-
|
|
2080
|
+
"Your seed phrase from the first run is still valid; nothing changed."
|
|
2064
2081
|
);
|
|
2082
|
+
console.log(
|
|
2083
|
+
"(Re-run with --force to regenerate, which REPLACES your keys.)"
|
|
2084
|
+
);
|
|
2085
|
+
printInitNextStep(dir);
|
|
2065
2086
|
return;
|
|
2066
2087
|
}
|
|
2067
2088
|
const walletPassword = password ?? process.env["TOWNHOUSE_WALLET_PASSWORD"];
|
|
@@ -2095,6 +2116,7 @@ async function handleInit(force, configDir, password, preset, yes) {
|
|
|
2095
2116
|
console.log(` ${"".padEnd(6)} EVM: ${info.evmAddress}`);
|
|
2096
2117
|
}
|
|
2097
2118
|
walletManager.lock();
|
|
2119
|
+
printInitNextStep(dir);
|
|
2098
2120
|
}
|
|
2099
2121
|
async function handleSetup(configDir, port, noBrowser, dockerInstance, browserOpener) {
|
|
2100
2122
|
const dir = resolve(configDir ?? DEFAULT_CONFIG_DIR);
|
|
@@ -3042,7 +3064,7 @@ async function handleHsUp(_configPath, configDir, config, docker, options) {
|
|
|
3042
3064
|
resolvedPassword = await promptPassword("Wallet password: ");
|
|
3043
3065
|
} else {
|
|
3044
3066
|
console.error(
|
|
3045
|
-
"Wallet password required
|
|
3067
|
+
"Wallet password required, but no interactive terminal is available to prompt.\nPass --password <pw> or set TOWNHOUSE_WALLET_PASSWORD."
|
|
3046
3068
|
);
|
|
3047
3069
|
process.exitCode = 1;
|
|
3048
3070
|
return;
|
|
@@ -3132,11 +3154,18 @@ async function handleHsUp(_configPath, configDir, config, docker, options) {
|
|
|
3132
3154
|
console.log(` [${pulled}/${apexImages.length}] ${ref}`);
|
|
3133
3155
|
await orch.pullImage(ref);
|
|
3134
3156
|
}
|
|
3157
|
+
} else {
|
|
3158
|
+
console.log(
|
|
3159
|
+
"No pinned image manifest found \u2014 Docker will pull images on demand."
|
|
3160
|
+
);
|
|
3161
|
+
console.log(
|
|
3162
|
+
"First start can take several minutes with limited progress output."
|
|
3163
|
+
);
|
|
3135
3164
|
}
|
|
3136
3165
|
} catch (pullErr) {
|
|
3137
3166
|
const detail = pullErr instanceof Error ? pullErr.message : String(pullErr);
|
|
3138
|
-
console.
|
|
3139
|
-
`
|
|
3167
|
+
console.log(
|
|
3168
|
+
`Could not pre-pull images (${detail}). Docker will pull them during startup \u2014 this is normal and may take a few minutes.`
|
|
3140
3169
|
);
|
|
3141
3170
|
}
|
|
3142
3171
|
}
|
|
@@ -3157,6 +3186,10 @@ async function handleHsUp(_configPath, configDir, config, docker, options) {
|
|
|
3157
3186
|
resolve(config.wallet.encrypted_path)
|
|
3158
3187
|
);
|
|
3159
3188
|
process.env["TOWNHOUSE_DOCKER_GID"] = String(dockerSockGid);
|
|
3189
|
+
if (!bootstrapStarted) {
|
|
3190
|
+
bootstrapStarted = true;
|
|
3191
|
+
ribbon.start("bootstrap");
|
|
3192
|
+
}
|
|
3160
3193
|
const MAX_ANON_RETRIES = 3;
|
|
3161
3194
|
try {
|
|
3162
3195
|
for (let attempt = 1; attempt <= MAX_ANON_RETRIES; attempt++) {
|
|
@@ -3231,11 +3264,23 @@ async function handleHsUp(_configPath, configDir, config, docker, options) {
|
|
|
3231
3264
|
});
|
|
3232
3265
|
ribbon.start("live", hostname);
|
|
3233
3266
|
if (shouldRenderInk()) {
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3267
|
+
try {
|
|
3268
|
+
const { mountTui } = await import("./tui-OIFXGBTL.js");
|
|
3269
|
+
const apiUrlOverride = process.env["HS_TOWNHOUSE_API_URL"];
|
|
3270
|
+
const mountOpts = apiUrlOverride !== void 0 ? { apiUrl: apiUrlOverride } : {};
|
|
3271
|
+
const instance = mountTui(mountOpts);
|
|
3272
|
+
await instance.waitUntilExit();
|
|
3273
|
+
} catch (tuiErr) {
|
|
3274
|
+
const detail = tuiErr instanceof Error ? tuiErr.message : String(tuiErr);
|
|
3275
|
+
console.error("");
|
|
3276
|
+
console.error(`Your node is live at ${hostname}.`);
|
|
3277
|
+
console.error(
|
|
3278
|
+
`The live dashboard could not open (${detail}) \u2014 this is a display issue, not a node issue. Your node keeps running.`
|
|
3279
|
+
);
|
|
3280
|
+
console.error(
|
|
3281
|
+
"Stop it anytime with: npx @toon-protocol/townhouse hs down"
|
|
3282
|
+
);
|
|
3283
|
+
}
|
|
3239
3284
|
}
|
|
3240
3285
|
} catch (err) {
|
|
3241
3286
|
const { exitCode } = renderFailure(err);
|
|
@@ -3672,7 +3717,14 @@ async function main(argv, dockerInstance, browserOpener, hsOverrides, nodeComman
|
|
|
3672
3717
|
}
|
|
3673
3718
|
}
|
|
3674
3719
|
var invokedFile = process.argv[1];
|
|
3675
|
-
var invokedDirectly =
|
|
3720
|
+
var invokedDirectly = false;
|
|
3721
|
+
if (typeof invokedFile === "string") {
|
|
3722
|
+
try {
|
|
3723
|
+
invokedDirectly = import.meta.url === pathToFileURL(realpathSync(invokedFile)).href;
|
|
3724
|
+
} catch {
|
|
3725
|
+
invokedDirectly = import.meta.url === pathToFileURL(invokedFile).href;
|
|
3726
|
+
}
|
|
3727
|
+
}
|
|
3676
3728
|
if (invokedDirectly) {
|
|
3677
3729
|
main(process.argv.slice(2)).catch((error) => {
|
|
3678
3730
|
if (error instanceof CliHelpRequested) {
|