traderclaw-cli 1.0.97 → 1.0.99
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/bin/installer-step-engine.mjs +24 -2
- package/bin/openclaw-trader.mjs +95 -23
- package/package.json +2 -2
|
@@ -1234,9 +1234,31 @@ async function restartGateway() {
|
|
|
1234
1234
|
if (!commandExists("openclaw")) return { ran: false };
|
|
1235
1235
|
try {
|
|
1236
1236
|
await runCommandWithEvents("openclaw", ["gateway", "restart"]);
|
|
1237
|
-
return { ran: true, success: true };
|
|
1238
1237
|
} catch {
|
|
1239
|
-
return { ran: true, success: false };
|
|
1238
|
+
return { ran: true, success: false, healthy: false };
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
// Brief wait then verify the gateway is actually healthy after the restart.
|
|
1242
|
+
await new Promise((r) => setTimeout(r, 2500));
|
|
1243
|
+
try {
|
|
1244
|
+
const raw = getCommandOutput("openclaw gateway status --json || true");
|
|
1245
|
+
let statusJson = null;
|
|
1246
|
+
if (raw) {
|
|
1247
|
+
try { statusJson = JSON.parse(raw); } catch { /* non-JSON output */ }
|
|
1248
|
+
}
|
|
1249
|
+
const serviceStatus = statusJson?.service?.runtime?.status;
|
|
1250
|
+
const rpcOk = statusJson?.rpc?.ok === true;
|
|
1251
|
+
const healthy = serviceStatus === "running" && rpcOk;
|
|
1252
|
+
if (!healthy) {
|
|
1253
|
+
console.warn(
|
|
1254
|
+
"[restartGateway] Gateway restarted but health check failed " +
|
|
1255
|
+
`(status=${serviceStatus ?? "unknown"}, rpc.ok=${rpcOk}). ` +
|
|
1256
|
+
"Check: journalctl --user -u openclaw-gateway",
|
|
1257
|
+
);
|
|
1258
|
+
}
|
|
1259
|
+
return { ran: true, success: true, healthy };
|
|
1260
|
+
} catch {
|
|
1261
|
+
return { ran: true, success: true, healthy: false };
|
|
1240
1262
|
}
|
|
1241
1263
|
}
|
|
1242
1264
|
|
package/bin/openclaw-trader.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { dirname, join } from "path";
|
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
7
7
|
import { homedir } from "os";
|
|
8
8
|
import { randomUUID, createPrivateKey, sign as cryptoSign } from "crypto";
|
|
9
|
-
import { execFile, execSync } from "child_process";
|
|
9
|
+
import { execFile, execFileSync, execSync } from "child_process";
|
|
10
10
|
import { promisify } from "util";
|
|
11
11
|
import { createServer } from "http";
|
|
12
12
|
import { resolvePluginPackageRoot } from "./resolve-plugin-root.mjs";
|
|
@@ -3760,6 +3760,9 @@ async function cmdInstall(args) {
|
|
|
3760
3760
|
print(` Then run: ${restartCommand}`);
|
|
3761
3761
|
}
|
|
3762
3762
|
printInfo("Wizard finish requested from browser. Closing server and returning shell prompt.");
|
|
3763
|
+
printInfo(
|
|
3764
|
+
"If you used SSH -L for ports 17890/1455: close browser tabs to the wizard, or open a new SSH session without those forwards. Otherwise the SSH client may print many \"channel … Connection refused\" lines after the servers stop — that is normal and stops once nothing tries those local ports or you reconnect.",
|
|
3765
|
+
);
|
|
3763
3766
|
server.close(() => process.exit(0));
|
|
3764
3767
|
}, 650);
|
|
3765
3768
|
return;
|
|
@@ -3906,6 +3909,9 @@ async function cmdInstall(args) {
|
|
|
3906
3909
|
printInfo("Press Ctrl+C to stop the wizard server.");
|
|
3907
3910
|
printInfo(`If you are on a remote VPS, forward both ports from your local machine:`);
|
|
3908
3911
|
printInfo(` ssh -L ${defaults.port}:127.0.0.1:${defaults.port} -L 1455:127.0.0.1:1455 <user>@<your-vps>`);
|
|
3912
|
+
printInfo(
|
|
3913
|
+
"When the wizard exits, reconnect without -L (or close tabs using those localhost ports) to avoid noisy SSH \"channel … Connection refused\" messages.",
|
|
3914
|
+
);
|
|
3909
3915
|
}
|
|
3910
3916
|
|
|
3911
3917
|
async function cmdTestSession(args) {
|
|
@@ -4169,7 +4175,12 @@ Commands:
|
|
|
4169
4175
|
status Check connection health and wallet status
|
|
4170
4176
|
config View and manage configuration
|
|
4171
4177
|
test-session Test session auth flow (refresh, rotation, challenge) without reinstalling
|
|
4172
|
-
update Update
|
|
4178
|
+
update Update global traderclaw-cli, re-sync the OpenClaw plugin (openclaw.json), and restart the gateway
|
|
4179
|
+
|
|
4180
|
+
Update options (traderclaw update):
|
|
4181
|
+
--beta Use the npm dist-tag "beta" for traderclaw-cli (default: "latest")
|
|
4182
|
+
--dry-run Show / simulate actions without fully applying (where supported)
|
|
4183
|
+
--skip-plugins Do not run "openclaw plugins update" (only npm + gateway restart)
|
|
4173
4184
|
|
|
4174
4185
|
Setup options:
|
|
4175
4186
|
--api-key, -k API key (skip interactive prompt)
|
|
@@ -4239,14 +4250,20 @@ Examples:
|
|
|
4239
4250
|
traderclaw test-session --wallet-private-key <base58_key>
|
|
4240
4251
|
traderclaw update
|
|
4241
4252
|
traderclaw update --beta
|
|
4253
|
+
traderclaw update --dry-run
|
|
4242
4254
|
`);
|
|
4243
4255
|
}
|
|
4244
4256
|
|
|
4245
4257
|
async function cmdUpdate(args) {
|
|
4246
4258
|
const tag = args.includes("--beta") ? "beta" : "latest";
|
|
4259
|
+
const dryRun = args.includes("--dry-run");
|
|
4260
|
+
const skipPlugins = args.includes("--skip-plugins");
|
|
4247
4261
|
|
|
4248
4262
|
print("\nTraderClaw — Update\n");
|
|
4249
4263
|
print("=".repeat(45));
|
|
4264
|
+
if (dryRun) {
|
|
4265
|
+
printInfo(" (dry-run: npm install and gateway restart are simulated where noted)\n");
|
|
4266
|
+
}
|
|
4250
4267
|
|
|
4251
4268
|
let currentVersion = "unknown";
|
|
4252
4269
|
try {
|
|
@@ -4254,40 +4271,95 @@ async function cmdUpdate(args) {
|
|
|
4254
4271
|
const data = JSON.parse(out);
|
|
4255
4272
|
currentVersion = data?.dependencies?.["traderclaw-cli"]?.version ?? "unknown";
|
|
4256
4273
|
} catch {}
|
|
4257
|
-
printInfo(`
|
|
4274
|
+
printInfo(` Global traderclaw-cli: ${currentVersion}`);
|
|
4258
4275
|
|
|
4259
4276
|
let latestVersion = "unknown";
|
|
4260
4277
|
try {
|
|
4261
4278
|
latestVersion = execSync(`npm view traderclaw-cli@${tag} version`, { encoding: "utf-8" }).trim();
|
|
4262
4279
|
} catch {}
|
|
4263
|
-
printInfo(`
|
|
4280
|
+
printInfo(` npm ${tag} tag resolves to:${" ".repeat(Math.max(1, 11 - tag.length))}${latestVersion}`);
|
|
4264
4281
|
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
}
|
|
4282
|
+
const cliUpToDate =
|
|
4283
|
+
currentVersion !== "unknown" && latestVersion !== "unknown" && currentVersion === latestVersion;
|
|
4284
|
+
const needNpmInstall = !cliUpToDate;
|
|
4269
4285
|
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4286
|
+
if (needNpmInstall) {
|
|
4287
|
+
if (dryRun) {
|
|
4288
|
+
print(`\n [dry-run] Would run: npm install -g traderclaw-cli@${tag}\n`);
|
|
4289
|
+
} else {
|
|
4290
|
+
print(`\n Installing traderclaw-cli@${tag} globally...\n`);
|
|
4291
|
+
try {
|
|
4292
|
+
execSync(`npm install -g traderclaw-cli@${tag}`, { stdio: "inherit" });
|
|
4293
|
+
printSuccess(`\n Global traderclaw-cli updated.`);
|
|
4294
|
+
} catch {
|
|
4295
|
+
printError("npm install failed. Try running manually:");
|
|
4296
|
+
print(` npm install -g traderclaw-cli@${tag}`);
|
|
4297
|
+
process.exit(1);
|
|
4298
|
+
}
|
|
4299
|
+
}
|
|
4300
|
+
} else {
|
|
4301
|
+
printSuccess(`\n Global traderclaw-cli is already on ${tag} (${currentVersion}).`);
|
|
4277
4302
|
}
|
|
4278
4303
|
|
|
4279
|
-
|
|
4280
|
-
|
|
4304
|
+
// OpenClaw still tracks a separate copy under extensions + plugins.installs in openclaw.json.
|
|
4305
|
+
// Always refresh that install so it matches the new CLI (spec / integrity / resolvedVersion).
|
|
4306
|
+
if (!skipPlugins) {
|
|
4307
|
+
if (!commandExists("openclaw")) {
|
|
4308
|
+
printWarn(`\n "openclaw" not found in PATH — cannot run "openclaw plugins update ${PLUGIN_ID}".`);
|
|
4309
|
+
print(" After installing the OpenClaw CLI, run:\n");
|
|
4310
|
+
print(` openclaw plugins update ${PLUGIN_ID}`);
|
|
4311
|
+
print(" Then: openclaw gateway restart");
|
|
4312
|
+
} else {
|
|
4313
|
+
const pluginUpdateArgs = ["plugins", "update", PLUGIN_ID];
|
|
4314
|
+
if (dryRun) {
|
|
4315
|
+
pluginUpdateArgs.push("--dry-run");
|
|
4316
|
+
}
|
|
4317
|
+
try {
|
|
4318
|
+
print(`\n Syncing OpenClaw plugin install (${PLUGIN_ID}, solana-traderclaw)...\n`);
|
|
4319
|
+
printInfo(
|
|
4320
|
+
` (updates ~/.openclaw/… plugin files and ${CONFIG_FILE} plugins.installs — do not hand-edit those versions)\n`,
|
|
4321
|
+
);
|
|
4322
|
+
execFileSync("openclaw", pluginUpdateArgs, { stdio: "inherit" });
|
|
4323
|
+
if (!dryRun) {
|
|
4324
|
+
printSuccess(`\n OpenClaw plugin "${PLUGIN_ID}" update finished.`);
|
|
4325
|
+
}
|
|
4326
|
+
} catch {
|
|
4327
|
+
if (dryRun) {
|
|
4328
|
+
printError(`openclaw plugins update ${PLUGIN_ID} --dry-run failed.`);
|
|
4329
|
+
} else {
|
|
4330
|
+
printError(`"openclaw plugins update ${PLUGIN_ID}" failed. You can try:`);
|
|
4331
|
+
print(` openclaw plugins update ${PLUGIN_ID}`);
|
|
4332
|
+
print(" or (all installed plugins) openclaw plugins update --all");
|
|
4333
|
+
}
|
|
4334
|
+
process.exit(1);
|
|
4335
|
+
}
|
|
4336
|
+
}
|
|
4337
|
+
} else {
|
|
4338
|
+
printWarn(`\n --skip-plugins: skipped "openclaw plugins update ${PLUGIN_ID}"; openclaw.json may still show an old plugin version.`);
|
|
4339
|
+
}
|
|
4281
4340
|
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4341
|
+
if (dryRun) {
|
|
4342
|
+
print(`\n [dry-run] Would run: openclaw gateway restart\n`);
|
|
4343
|
+
} else {
|
|
4344
|
+
if (!commandExists("openclaw")) {
|
|
4345
|
+
printWarn("\n Skipping gateway restart: openclaw not in PATH. After fixing PATH: openclaw gateway restart");
|
|
4346
|
+
} else {
|
|
4347
|
+
print("\n Restarting gateway...\n");
|
|
4348
|
+
try {
|
|
4349
|
+
execFileSync("openclaw", ["gateway", "restart"], { stdio: "inherit" });
|
|
4350
|
+
printSuccess(" Gateway restarted.");
|
|
4351
|
+
} catch {
|
|
4352
|
+
printWarn(" Gateway restart returned non-zero. Try manually: openclaw gateway restart");
|
|
4353
|
+
}
|
|
4354
|
+
}
|
|
4287
4355
|
}
|
|
4288
4356
|
|
|
4289
4357
|
print("\n" + "=".repeat(45));
|
|
4290
|
-
|
|
4358
|
+
if (dryRun) {
|
|
4359
|
+
printSuccess("\n Dry run finished. Re-run without --dry-run to apply.\n");
|
|
4360
|
+
} else {
|
|
4361
|
+
printSuccess("\n Update complete!\n");
|
|
4362
|
+
}
|
|
4291
4363
|
}
|
|
4292
4364
|
|
|
4293
4365
|
async function cmdRepairOpenclaw() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "traderclaw-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.99",
|
|
4
4
|
"description": "Global TraderClaw CLI (install --wizard, setup, precheck). Installs solana-traderclaw as a dependency for OpenClaw plugin files.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"node": ">=22"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"solana-traderclaw": "^1.0.
|
|
20
|
+
"solana-traderclaw": "^1.0.99"
|
|
21
21
|
},
|
|
22
22
|
"keywords": [
|
|
23
23
|
"traderclaw",
|