traderclaw-cli 1.0.79 → 1.0.80

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.
@@ -400,6 +400,14 @@ function isOpenClawConfigSchemaFailure(text) {
400
400
  function runCommandWithEvents(cmd, args = [], opts = {}) {
401
401
  return new Promise((resolve, reject) => {
402
402
  const { onEvent, ...spawnOpts } = opts;
403
+ const isNpm = /(?:^|[\\/])npm(?:\.cmd)?$/.test(cmd) || cmd === "npm";
404
+ if (isNpm && !spawnOpts.env?.NODE_OPTIONS?.includes("max-old-space-size")) {
405
+ spawnOpts.env = {
406
+ ...process.env,
407
+ ...spawnOpts.env,
408
+ NODE_OPTIONS: [spawnOpts.env?.NODE_OPTIONS || process.env.NODE_OPTIONS || "", "--max-old-space-size=512"].filter(Boolean).join(" "),
409
+ };
410
+ }
403
411
  const child = spawn(cmd, args, {
404
412
  stdio: "pipe",
405
413
  shell: true,
@@ -427,14 +435,19 @@ function runCommandWithEvents(cmd, args = [], opts = {}) {
427
435
  const urls = [...new Set([...extractUrls(stdout), ...extractUrls(stderr)])];
428
436
  if (code === 0) resolve({ stdout, stderr, code, urls });
429
437
  else {
438
+ const isOom = code === 137 || (stderr || stdout || "").includes("Killed");
430
439
  const raw = (stderr || "").trim();
431
440
  const tailLines = raw.split("\n").filter((l) => l.length > 0).slice(-40).join("\n");
432
441
  const stderrPreview = tailLines.length > 8000 ? tailLines.slice(-8000) : tailLines;
433
- const err = new Error(stderrPreview ? `command failed with exit code ${code}: ${stderrPreview}` : `command failed with exit code ${code}`);
442
+ const prefix = isOom
443
+ ? `Out of memory (exit 137 / SIGKILL): the host killed '${cmd}' — try a machine with ≥1 GB free RAM, or reduce concurrency with npm_config_maxsockets=2`
444
+ : `command failed with exit code ${code}`;
445
+ const err = new Error(stderrPreview ? `${prefix}: ${stderrPreview}` : prefix);
434
446
  err.code = code;
435
447
  err.stdout = stdout;
436
448
  err.stderr = stderr;
437
449
  err.urls = urls;
450
+ err.oom = isOom;
438
451
  reject(err);
439
452
  }
440
453
  });
@@ -454,6 +467,14 @@ function getGlobalOpenClawPackageDir() {
454
467
  * incomplete `node_modules` after `npm install -g` (hoisting, optional deps, or interrupted
455
468
  * installs). OpenClaw then fails at runtime with `Cannot find module 'grammy'` while loading
456
469
  * config. Installing from the package directory restores declared dependencies.
470
+ *
471
+ * `--ignore-scripts` avoids OpenClaw's postinstall (and nested installs) failing on hosts without
472
+ * a C toolchain: e.g. `@discordjs/opus` has no prebuild for Node 22 and falls back to `node-gyp`
473
+ * (`make` not found). Skipping scripts still installs declared JS deps (e.g. `grammy`). Users who
474
+ * need native/voice features can install build-essential and re-run `npm install` without
475
+ * `--ignore-scripts` in the global openclaw directory.
476
+ *
477
+ * We still run `npm install grammy @buape/carbon --no-save` with `--ignore-scripts` as a safety net.
457
478
  */
458
479
  /** Runs `npm install` in the global `openclaw` package directory (fixes missing `grammy` etc.). */
459
480
  export async function ensureOpenClawGlobalPackageDependencies() {
@@ -461,10 +482,23 @@ export async function ensureOpenClawGlobalPackageDependencies() {
461
482
  if (!dir) {
462
483
  return { skipped: true, reason: "global_openclaw_dir_not_found" };
463
484
  }
464
- await runCommandWithEvents("npm", ["install", "--omit=dev", "--registry", "https://registry.npmjs.org/"], {
465
- cwd: dir,
466
- shell: false,
467
- });
485
+ const registry = "https://registry.npmjs.org/";
486
+ const installFlags = ["install", "--omit=dev", "--ignore-scripts", "--registry", registry];
487
+ await runCommandWithEvents("npm", installFlags, { cwd: dir, shell: false });
488
+ await runCommandWithEvents(
489
+ "npm",
490
+ [
491
+ "install",
492
+ "--omit=dev",
493
+ "--no-save",
494
+ "--ignore-scripts",
495
+ "--registry",
496
+ registry,
497
+ "grammy",
498
+ "@buape/carbon",
499
+ ],
500
+ { cwd: dir, shell: false },
501
+ );
468
502
  return { repaired: true, dir };
469
503
  }
470
504
 
@@ -477,7 +511,7 @@ export async function ensureOpenClawGlobalPackageDependencies() {
477
511
  async function installOpenClawPlatform() {
478
512
  const hadOpenclaw = commandExists("openclaw");
479
513
  const previousVersion = hadOpenclaw ? getCommandOutput("openclaw --version") : null;
480
- await runCommandWithEvents("npm", ["install", "-g", "--registry", "https://registry.npmjs.org/", "openclaw@latest"]);
514
+ await runCommandWithEvents("npm", ["install", "-g", "--ignore-scripts", "--registry", "https://registry.npmjs.org/", "openclaw@latest"]);
481
515
  const available = commandExists("openclaw");
482
516
  const version = available ? getCommandOutput("openclaw --version") : null;
483
517
  if (!available) {
@@ -514,7 +548,7 @@ function isNpmFilesystemPackageSpec(spec) {
514
548
  * IMPORTANT: run with `{ shell: false }` — `spawn(..., { shell: true })` can drop argv on Unix and npm then mis-resolves the package name.
515
549
  */
516
550
  function npmGlobalInstallArgs(spec, { force = false } = {}) {
517
- const args = ["install", "-g"];
551
+ const args = ["install", "-g", "--ignore-scripts"];
518
552
  if (force) args.push("--force");
519
553
  if (!isNpmFilesystemPackageSpec(spec)) {
520
554
  args.push("--registry", "https://registry.npmjs.org/");
@@ -4078,7 +4078,7 @@ Commands:
4078
4078
  signup Create a new account (alias for: setup --signup; run locally, not via the agent)
4079
4079
  precheck Run environment checks (dry-run or allow-install)
4080
4080
  install Launch installer flows (--wizard for localhost GUI)
4081
- repair-openclaw Re-run npm install in the global openclaw package (fixes missing grammy after upgrade)
4081
+ repair-openclaw Re-run npm install in the global openclaw package (fixes missing grammy / @buape/carbon; uses --ignore-scripts so @discordjs/opus does not require build tools)
4082
4082
  gateway Gateway helpers (see subcommands below)
4083
4083
  login Re-authenticate (uses refresh token when valid; full challenge only if needed)
4084
4084
  logout Revoke current session and clear tokens
@@ -4152,7 +4152,7 @@ Examples:
4152
4152
 
4153
4153
  async function cmdRepairOpenclaw() {
4154
4154
  const { ensureOpenClawGlobalPackageDependencies } = await import("./installer-step-engine.mjs");
4155
- printInfo("Repairing global OpenClaw npm dependencies (fixes missing grammy / MODULE_NOT_FOUND)...");
4155
+ printInfo("Repairing global OpenClaw npm dependencies (fixes missing grammy, @buape/carbon, etc.)...");
4156
4156
  const r = await ensureOpenClawGlobalPackageDependencies();
4157
4157
  if (r.skipped) {
4158
4158
  printError(`Could not find global OpenClaw package (${r.reason}). Install or upgrade: npm install -g openclaw@latest`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "traderclaw-cli",
3
- "version": "1.0.79",
3
+ "version": "1.0.80",
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.79"
20
+ "solana-traderclaw": "^1.0.80"
21
21
  },
22
22
  "keywords": [
23
23
  "traderclaw",