traderclaw-cli 1.0.68 → 1.0.70

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.
@@ -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 = {};
@@ -961,6 +993,21 @@ function configureGatewayScheduling(modeConfig, configPath = CONFIG_FILE) {
961
993
  const cronStorePath = resolveCronJobsStorePath(config);
962
994
  const cronMerge = mergeTraderCronJobsIntoStore(cronStorePath, targetJobs);
963
995
 
996
+ let qmdAvailable = false;
997
+ let qmdVersion = null;
998
+ try { qmdAvailable = commandExists("qmd"); } catch {}
999
+ if (qmdAvailable) {
1000
+ qmdVersion = getCommandOutput("qmd --version");
1001
+ } else {
1002
+ if (typeof console !== "undefined") {
1003
+ console.warn(
1004
+ "[traderclaw] QMD binary not found. Memory engine will fall back to SQLite (no vector search, no temporal decay, no MMR).\n" +
1005
+ "Install QMD: bun install -g @tobilu/qmd\n" +
1006
+ "Then restart the gateway: openclaw gateway restart"
1007
+ );
1008
+ }
1009
+ }
1010
+
964
1011
  return {
965
1012
  configPath,
966
1013
  agentsConfigured: targetAgents.length,
@@ -972,6 +1019,8 @@ function configureGatewayScheduling(modeConfig, configPath = CONFIG_FILE) {
972
1019
  cronJobsStoreError: cronMerge.error,
973
1020
  removedLegacyCronJobs,
974
1021
  hooksConfigured: config.hooks.mappings.length,
1022
+ qmdAvailable,
1023
+ qmdVersion,
975
1024
  isV2,
976
1025
  };
977
1026
  }
@@ -1139,13 +1188,23 @@ function seedXConfig(modeConfig, configPath = CONFIG_FILE, wizardOpts = {}) {
1139
1188
  entry.config.x.profiles = {};
1140
1189
  }
1141
1190
 
1142
- const agentIds = modeConfig.pluginId === "solana-trader-v2"
1143
- ? ["cto", "intern"]
1144
- : ["main"];
1191
+ const agentIds =
1192
+ modeConfig.pluginId === "solana-trader-v2"
1193
+ ? ["cto", "intern"]
1194
+ : modeConfig.pluginId === "solana-trader"
1195
+ ? ["main", "solana-trader"]
1196
+ : ["main"];
1145
1197
  let profilesFound = 0;
1146
1198
 
1147
1199
  for (const agentId of agentIds) {
1148
- const { at, ats } = getAccessPairForAgent(wizardOpts, agentId);
1200
+ let { at, ats } = getAccessPairForAgent(wizardOpts, agentId);
1201
+ if (
1202
+ modeConfig.pluginId === "solana-trader"
1203
+ && agentId === "solana-trader"
1204
+ && (!at || !ats)
1205
+ ) {
1206
+ ({ at, ats } = getAccessPairForAgent(wizardOpts, "main"));
1207
+ }
1149
1208
  if (at && ats) {
1150
1209
  entry.config.x.profiles[agentId] = { accessToken: at, accessTokenSecret: ats };
1151
1210
  profilesFound++;
@@ -1790,9 +1849,15 @@ export class InstallerStepEngine {
1790
1849
  "Telegram token is required for this installer flow. Add your bot token in the wizard and start again.",
1791
1850
  );
1792
1851
  }
1793
- await runCommandWithEvents("openclaw", ["plugins", "enable", "telegram"]);
1794
- await runCommandWithEvents("openclaw", ["channels", "add", "--channel", "telegram", "--token", this.options.telegramToken]);
1795
- await runCommandWithEvents("openclaw", ["channels", "status", "--probe"]);
1852
+
1853
+ // OpenClaw no longer supports `openclaw channels add --channel telegram`.
1854
+ // The Telegram plugin does not export register/activate, so that command
1855
+ // fails with "telegram missing register/activate export / Channel telegram
1856
+ // does not support add." The current documented approach is to write the
1857
+ // bot token directly to openclaw.json — see docs.openclaw.ai/channels/telegram.
1858
+ writeTelegramChannelConfig(this.options.telegramToken, CONFIG_FILE);
1859
+ this.emitLog("telegram_required", "info", "Telegram bot token written to openclaw.json (channels.telegram.botToken).");
1860
+
1796
1861
  const policy = ensureTelegramGroupPolicyOpenForWizard();
1797
1862
  if (policy.changed) {
1798
1863
  this.emitLog(
@@ -1801,6 +1866,14 @@ export class InstallerStepEngine {
1801
1866
  "Set channels.telegram.groupPolicy=open (no sender allowlist yet) to avoid Doctor allowlist warnings on gateway restart. Tighten groupAllowFrom later if you use groups.",
1802
1867
  );
1803
1868
  }
1869
+
1870
+ // Probe channel status for visibility — best-effort, don't fail the step.
1871
+ try {
1872
+ await runCommandWithEvents("openclaw", ["channels", "status", "--probe"]);
1873
+ } catch {
1874
+ 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.");
1875
+ }
1876
+
1804
1877
  return { configured: true };
1805
1878
  }
1806
1879
 
@@ -858,7 +858,9 @@ async function cmdSetup(args) {
858
858
 
859
859
  const existingForRecovery = readConfig();
860
860
  const prevPlugin = getPluginConfig(existingForRecovery);
861
+ const prevSafe = prevPlugin && typeof prevPlugin === "object" ? { ...prevPlugin } : {};
861
862
  const pluginConfig = {
863
+ ...prevSafe,
862
864
  orchestratorUrl,
863
865
  walletId: null,
864
866
  apiKey,
@@ -2118,7 +2120,7 @@ function wizardHtml(defaults) {
2118
2120
  <input id="xAccessTokenMainSecret" type="password" autocomplete="off" />
2119
2121
  </div>
2120
2122
  </div>
2121
- <p class="muted">If you use X: create an app at <a href="https://developer.x.com" target="_blank" rel="noopener noreferrer">developer.x.com</a> with OAuth 1.0a Read and Write, and fill all four fields above (or leave all blank). Values are written to <code>openclaw.json</code> under the plugin <code>x</code> block.</p>
2123
+ <p class="muted">If you use X: create an app at <a href="https://developer.x.com" target="_blank" rel="noopener noreferrer">developer.x.com</a> with OAuth 1.0a Read and Write, and fill all four fields above (or leave all blank). Values are written to <code>openclaw.json</code> at <code>plugins.entries.solana-trader.config.x</code> (consumer key/secret plus <code>profiles.main</code> and <code>profiles.solana-trader</code>, same tokens unless you set <code>X_ACCESS_TOKEN_SOLANA_TRADER</code> / <code>_SECRET</code>).</p>
2122
2124
  </div>
2123
2125
  <div class="card" id="startCard">
2124
2126
  <div class="grid">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "traderclaw-cli",
3
- "version": "1.0.68",
3
+ "version": "1.0.70",
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.68"
20
+ "solana-traderclaw": "^1.0.70"
21
21
  },
22
22
  "keywords": [
23
23
  "traderclaw",