traderclaw-cli 1.0.100 → 1.0.102

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.
@@ -171,6 +171,53 @@ function extractJson(raw) {
171
171
  /** Env vars passed to every openclaw CLI invocation to suppress colour output. */
172
172
  const NO_COLOR_ENV = { ...process.env, NO_COLOR: "1", FORCE_COLOR: "0" };
173
173
 
174
+ function delay(ms) {
175
+ return new Promise((resolve) => setTimeout(resolve, ms));
176
+ }
177
+
178
+ /** True when OpenClaw / ClawHub reports HTTP 429 or rate limiting (retry installs instead of failing). */
179
+ function isOpenClawClawHubRateLimit(combinedOutput) {
180
+ const t = stripAnsi(String(combinedOutput || "")).toLowerCase();
181
+ return /\b429\b/.test(t) || t.includes("rate limit") || t.includes("too many requests");
182
+ }
183
+
184
+ /**
185
+ * Runs `openclaw plugins install … --force` with backoff retries when ClawHub returns 429.
186
+ */
187
+ async function runOpenclawPluginsInstallWithRetry(installArgs, installSpec) {
188
+ const maxAttempts = 5;
189
+ const baseDelayMs = 12000;
190
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
191
+ try {
192
+ const r = await execFileAsync("openclaw", installArgs, {
193
+ maxBuffer: 15 * 1024 * 1024,
194
+ env: NO_COLOR_ENV,
195
+ });
196
+ if (r.stdout) process.stdout.write(r.stdout);
197
+ if (r.stderr) process.stderr.write(r.stderr);
198
+ return;
199
+ } catch (e) {
200
+ const stdout =
201
+ typeof e.stdout === "string" ? e.stdout : Buffer.isBuffer(e.stdout) ? e.stdout.toString("utf-8") : "";
202
+ const stderr =
203
+ typeof e.stderr === "string" ? e.stderr : Buffer.isBuffer(e.stderr) ? e.stderr.toString("utf-8") : "";
204
+ const combined = `${stdout}${stderr}${e.message || ""}`;
205
+ if (stdout) process.stdout.write(stdout);
206
+ if (stderr) process.stderr.write(stderr);
207
+ const retryable = isOpenClawClawHubRateLimit(combined);
208
+ if (attempt < maxAttempts && retryable) {
209
+ const waitMs = Math.min(baseDelayMs * 2 ** (attempt - 1), 180000);
210
+ printWarn(
211
+ ` ClawHub rate limited while installing ${installSpec} (attempt ${attempt}/${maxAttempts}). Waiting ${Math.round(waitMs / 1000)}s, then retrying…`,
212
+ );
213
+ await delay(waitMs);
214
+ continue;
215
+ }
216
+ throw e;
217
+ }
218
+ }
219
+ }
220
+
174
221
  function getCommandOutput(cmd) {
175
222
  try {
176
223
  return execSync(cmd, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], shell: true, maxBuffer: 50 * 1024 * 1024, env: NO_COLOR_ENV }).trim();
@@ -4361,9 +4408,27 @@ async function cmdUpdate(args) {
4361
4408
  `\n Forcing full integration: openclaw plugins install ${installSpec} --force\n` +
4362
4409
  " (extension on disk + plugins.installs / integrity.)\n",
4363
4410
  );
4364
- execFileSync("openclaw", installArgs, { stdio: "inherit" });
4411
+ await runOpenclawPluginsInstallWithRetry(installArgs, installSpec);
4365
4412
  printSuccess(`\n Forced install complete: ${installSpec}.`);
4366
- } catch {
4413
+ } catch (e) {
4414
+ const out =
4415
+ typeof e.stdout === "string"
4416
+ ? e.stdout
4417
+ : Buffer.isBuffer(e.stdout)
4418
+ ? e.stdout.toString("utf-8")
4419
+ : "";
4420
+ const err =
4421
+ typeof e.stderr === "string"
4422
+ ? e.stderr
4423
+ : Buffer.isBuffer(e.stderr)
4424
+ ? e.stderr.toString("utf-8")
4425
+ : "";
4426
+ const blob = `${out}${err}${e.message || ""}`;
4427
+ if (isOpenClawClawHubRateLimit(blob)) {
4428
+ printWarn(
4429
+ ` ClawHub rate limit persisted after retries — plugin files may still match the version from "plugins update" until this step succeeds.`,
4430
+ );
4431
+ }
4367
4432
  printError(`"openclaw plugins install ${installSpec} --force" failed. Try manually:`);
4368
4433
  print(` openclaw plugins install ${installSpec} --force`);
4369
4434
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "traderclaw-cli",
3
- "version": "1.0.100",
3
+ "version": "1.0.102",
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.100"
20
+ "solana-traderclaw": "^1.0.102"
21
21
  },
22
22
  "keywords": [
23
23
  "traderclaw",