traderclaw-cli 1.0.66 → 1.0.69
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 +107 -4
- package/package.json +2 -2
|
@@ -199,6 +199,38 @@ const NO_COLOR_ENV = { ...process.env, NO_COLOR: "1", FORCE_COLOR: "0" };
|
|
|
199
199
|
* every gateway restart and group messages are dropped. Wizard onboarding targets DMs first; set
|
|
200
200
|
* explicit "open" unless the user already configured sender allowlists.
|
|
201
201
|
*/
|
|
202
|
+
/**
|
|
203
|
+
* Write Telegram bot token directly to openclaw.json.
|
|
204
|
+
*
|
|
205
|
+
* `openclaw channels add --channel telegram` was removed — the Telegram plugin
|
|
206
|
+
* no longer exports register/activate, so the CLI rejects that call with
|
|
207
|
+
* "telegram missing register/activate export / Channel telegram does not support add."
|
|
208
|
+
*
|
|
209
|
+
* The current OpenClaw approach (docs.openclaw.ai/channels/telegram):
|
|
210
|
+
* channels.telegram.botToken = "<token>" → token source
|
|
211
|
+
* channels.telegram.enabled = true → enable the channel
|
|
212
|
+
* channels.telegram.dmPolicy = "pairing" → safe default (user approves first DM)
|
|
213
|
+
*/
|
|
214
|
+
function writeTelegramChannelConfig(botToken, configPath = CONFIG_FILE) {
|
|
215
|
+
let config = {};
|
|
216
|
+
try {
|
|
217
|
+
config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
218
|
+
} catch {
|
|
219
|
+
config = {};
|
|
220
|
+
}
|
|
221
|
+
if (!config.channels || typeof config.channels !== "object") config.channels = {};
|
|
222
|
+
if (!config.channels.telegram || typeof config.channels.telegram !== "object") config.channels.telegram = {};
|
|
223
|
+
config.channels.telegram.enabled = true;
|
|
224
|
+
config.channels.telegram.botToken = botToken;
|
|
225
|
+
// Only set dmPolicy if not already configured (preserve existing policy on re-installs).
|
|
226
|
+
if (!config.channels.telegram.dmPolicy) {
|
|
227
|
+
config.channels.telegram.dmPolicy = "pairing";
|
|
228
|
+
}
|
|
229
|
+
ensureAgentsDefaultsSchemaCompat(config);
|
|
230
|
+
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
231
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
232
|
+
}
|
|
233
|
+
|
|
202
234
|
function ensureTelegramGroupPolicyOpenForWizard(configPath = CONFIG_FILE) {
|
|
203
235
|
if (!existsSync(configPath)) return { changed: false };
|
|
204
236
|
let config = {};
|
|
@@ -1340,6 +1372,58 @@ function ensureAgentsDefaultsSchemaCompat(config) {
|
|
|
1340
1372
|
}
|
|
1341
1373
|
|
|
1342
1374
|
/** Re-read config from disk and re-apply defaults shape before gateway/plugin commands that validate the file. */
|
|
1375
|
+
/**
|
|
1376
|
+
* Proactively writes the minimum gateway fields required for OpenClaw to start.
|
|
1377
|
+
*
|
|
1378
|
+
* OpenClaw (post-2025) requires `gateway.mode` to be explicitly set to "local"
|
|
1379
|
+
* before `openclaw gateway install` / `gateway restart` are called — the service
|
|
1380
|
+
* crashes immediately at launch when the field is absent, producing
|
|
1381
|
+
* "service stayed stopped / health checks never came up".
|
|
1382
|
+
*
|
|
1383
|
+
* We write these proactively rather than waiting for the first failure and
|
|
1384
|
+
* hoping auto-recovery catches it, because newer OpenClaw validates the config
|
|
1385
|
+
* during `gateway install` itself, before the process even starts.
|
|
1386
|
+
*/
|
|
1387
|
+
function ensureGatewayBootstrapDefaults(configPath = CONFIG_FILE, log = () => {}) {
|
|
1388
|
+
let config = {};
|
|
1389
|
+
try {
|
|
1390
|
+
config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
1391
|
+
} catch {
|
|
1392
|
+
config = {};
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
if (!config.gateway || typeof config.gateway !== "object") {
|
|
1396
|
+
config.gateway = {};
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
const changed = [];
|
|
1400
|
+
if (!config.gateway.mode) {
|
|
1401
|
+
config.gateway.mode = "local";
|
|
1402
|
+
changed.push("gateway.mode=local");
|
|
1403
|
+
}
|
|
1404
|
+
if (!config.gateway.bind) {
|
|
1405
|
+
config.gateway.bind = "loopback";
|
|
1406
|
+
changed.push("gateway.bind=loopback");
|
|
1407
|
+
}
|
|
1408
|
+
if (!Number.isInteger(config.gateway.port)) {
|
|
1409
|
+
config.gateway.port = 18789;
|
|
1410
|
+
changed.push("gateway.port=18789");
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
ensureAgentsDefaultsSchemaCompat(config);
|
|
1414
|
+
|
|
1415
|
+
if (changed.length > 0) {
|
|
1416
|
+
log(`Gateway bootstrap: pre-writing required config fields: ${changed.join(", ")}`);
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
try {
|
|
1420
|
+
mkdirSync(dirname(configPath), { recursive: true });
|
|
1421
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
1422
|
+
} catch (err) {
|
|
1423
|
+
log(`Gateway bootstrap: could not write config defaults (${err?.message || err}) — will proceed anyway`);
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1343
1427
|
function normalizeOpenClawConfigFileShape(configPath = CONFIG_FILE) {
|
|
1344
1428
|
let config = {};
|
|
1345
1429
|
try {
|
|
@@ -1738,9 +1822,15 @@ export class InstallerStepEngine {
|
|
|
1738
1822
|
"Telegram token is required for this installer flow. Add your bot token in the wizard and start again.",
|
|
1739
1823
|
);
|
|
1740
1824
|
}
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1825
|
+
|
|
1826
|
+
// OpenClaw no longer supports `openclaw channels add --channel telegram`.
|
|
1827
|
+
// The Telegram plugin does not export register/activate, so that command
|
|
1828
|
+
// fails with "telegram missing register/activate export / Channel telegram
|
|
1829
|
+
// does not support add." The current documented approach is to write the
|
|
1830
|
+
// bot token directly to openclaw.json — see docs.openclaw.ai/channels/telegram.
|
|
1831
|
+
writeTelegramChannelConfig(this.options.telegramToken, CONFIG_FILE);
|
|
1832
|
+
this.emitLog("telegram_required", "info", "Telegram bot token written to openclaw.json (channels.telegram.botToken).");
|
|
1833
|
+
|
|
1744
1834
|
const policy = ensureTelegramGroupPolicyOpenForWizard();
|
|
1745
1835
|
if (policy.changed) {
|
|
1746
1836
|
this.emitLog(
|
|
@@ -1749,6 +1839,14 @@ export class InstallerStepEngine {
|
|
|
1749
1839
|
"Set channels.telegram.groupPolicy=open (no sender allowlist yet) to avoid Doctor allowlist warnings on gateway restart. Tighten groupAllowFrom later if you use groups.",
|
|
1750
1840
|
);
|
|
1751
1841
|
}
|
|
1842
|
+
|
|
1843
|
+
// Probe channel status for visibility — best-effort, don't fail the step.
|
|
1844
|
+
try {
|
|
1845
|
+
await runCommandWithEvents("openclaw", ["channels", "status", "--probe"]);
|
|
1846
|
+
} catch {
|
|
1847
|
+
this.emitLog("telegram_required", "warn", "channels status --probe did not complete (gateway may not be fully up yet). Token is written and will be active after gateway restart.");
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1752
1850
|
return { configured: true };
|
|
1753
1851
|
}
|
|
1754
1852
|
|
|
@@ -1876,7 +1974,12 @@ export class InstallerStepEngine {
|
|
|
1876
1974
|
});
|
|
1877
1975
|
await this.runStep("gateway_bootstrap", "Starting OpenClaw gateway and Funnel", async () => {
|
|
1878
1976
|
try {
|
|
1879
|
-
|
|
1977
|
+
// Ensure required gateway fields are present BEFORE install/restart.
|
|
1978
|
+
// OpenClaw now requires gateway.mode="local" to be explicitly set;
|
|
1979
|
+
// without it the service crashes immediately at startup.
|
|
1980
|
+
ensureGatewayBootstrapDefaults(CONFIG_FILE, (msg) =>
|
|
1981
|
+
this.emitLog("gateway_bootstrap", "info", msg),
|
|
1982
|
+
);
|
|
1880
1983
|
await this.runWithPrivilegeGuidance("gateway_bootstrap", "openclaw", ["gateway", "install"]);
|
|
1881
1984
|
await this.runWithPrivilegeGuidance("gateway_bootstrap", "openclaw", ["gateway", "restart"]);
|
|
1882
1985
|
return this.runFunnel();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "traderclaw-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.69",
|
|
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.69"
|
|
21
21
|
},
|
|
22
22
|
"keywords": [
|
|
23
23
|
"traderclaw",
|