traderclaw-cli 1.0.66 → 1.0.68

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.
@@ -1340,6 +1340,58 @@ function ensureAgentsDefaultsSchemaCompat(config) {
1340
1340
  }
1341
1341
 
1342
1342
  /** Re-read config from disk and re-apply defaults shape before gateway/plugin commands that validate the file. */
1343
+ /**
1344
+ * Proactively writes the minimum gateway fields required for OpenClaw to start.
1345
+ *
1346
+ * OpenClaw (post-2025) requires `gateway.mode` to be explicitly set to "local"
1347
+ * before `openclaw gateway install` / `gateway restart` are called — the service
1348
+ * crashes immediately at launch when the field is absent, producing
1349
+ * "service stayed stopped / health checks never came up".
1350
+ *
1351
+ * We write these proactively rather than waiting for the first failure and
1352
+ * hoping auto-recovery catches it, because newer OpenClaw validates the config
1353
+ * during `gateway install` itself, before the process even starts.
1354
+ */
1355
+ function ensureGatewayBootstrapDefaults(configPath = CONFIG_FILE, log = () => {}) {
1356
+ let config = {};
1357
+ try {
1358
+ config = JSON.parse(readFileSync(configPath, "utf-8"));
1359
+ } catch {
1360
+ config = {};
1361
+ }
1362
+
1363
+ if (!config.gateway || typeof config.gateway !== "object") {
1364
+ config.gateway = {};
1365
+ }
1366
+
1367
+ const changed = [];
1368
+ if (!config.gateway.mode) {
1369
+ config.gateway.mode = "local";
1370
+ changed.push("gateway.mode=local");
1371
+ }
1372
+ if (!config.gateway.bind) {
1373
+ config.gateway.bind = "loopback";
1374
+ changed.push("gateway.bind=loopback");
1375
+ }
1376
+ if (!Number.isInteger(config.gateway.port)) {
1377
+ config.gateway.port = 18789;
1378
+ changed.push("gateway.port=18789");
1379
+ }
1380
+
1381
+ ensureAgentsDefaultsSchemaCompat(config);
1382
+
1383
+ if (changed.length > 0) {
1384
+ log(`Gateway bootstrap: pre-writing required config fields: ${changed.join(", ")}`);
1385
+ }
1386
+
1387
+ try {
1388
+ mkdirSync(dirname(configPath), { recursive: true });
1389
+ writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
1390
+ } catch (err) {
1391
+ log(`Gateway bootstrap: could not write config defaults (${err?.message || err}) — will proceed anyway`);
1392
+ }
1393
+ }
1394
+
1343
1395
  function normalizeOpenClawConfigFileShape(configPath = CONFIG_FILE) {
1344
1396
  let config = {};
1345
1397
  try {
@@ -1876,7 +1928,12 @@ export class InstallerStepEngine {
1876
1928
  });
1877
1929
  await this.runStep("gateway_bootstrap", "Starting OpenClaw gateway and Funnel", async () => {
1878
1930
  try {
1879
- normalizeOpenClawConfigFileShape(CONFIG_FILE);
1931
+ // Ensure required gateway fields are present BEFORE install/restart.
1932
+ // OpenClaw now requires gateway.mode="local" to be explicitly set;
1933
+ // without it the service crashes immediately at startup.
1934
+ ensureGatewayBootstrapDefaults(CONFIG_FILE, (msg) =>
1935
+ this.emitLog("gateway_bootstrap", "info", msg),
1936
+ );
1880
1937
  await this.runWithPrivilegeGuidance("gateway_bootstrap", "openclaw", ["gateway", "install"]);
1881
1938
  await this.runWithPrivilegeGuidance("gateway_bootstrap", "openclaw", ["gateway", "restart"]);
1882
1939
  return this.runFunnel();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "traderclaw-cli",
3
- "version": "1.0.66",
3
+ "version": "1.0.68",
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.66"
20
+ "solana-traderclaw": "^1.0.68"
21
21
  },
22
22
  "keywords": [
23
23
  "traderclaw",