@lark-apaas/openclaw-scripts-diagnose-cli 0.1.9-alpha.0 → 0.1.9-alpha.1

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.
Files changed (2) hide show
  1. package/dist/index.cjs +15 -11
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -52,7 +52,7 @@ node_assert = __toESM(node_assert);
52
52
  * it terse and parseable.
53
53
  */
54
54
  function getVersion() {
55
- return "0.1.9-alpha.0";
55
+ return "0.1.9-alpha.1";
56
56
  }
57
57
  //#endregion
58
58
  //#region src/rule-engine/base.ts
@@ -1905,22 +1905,23 @@ let FeishuBotIdRule = class FeishuBotIdRule extends DiagnoseRule {
1905
1905
  if (mismatched.length === 0) return { pass: true };
1906
1906
  return {
1907
1907
  pass: false,
1908
- message: `channels.feishu.accounts botId/appId mismatch: ${mismatched.join(", ")}`
1908
+ message: `channels.feishu.accounts account key/appId mismatch: ${mismatched.join(", ")}`
1909
1909
  };
1910
1910
  }
1911
1911
  repair(ctx) {
1912
1912
  const accounts = asRecord(getNestedMap(ctx.config, "channels", "feishu")?.accounts);
1913
1913
  if (!accounts) return;
1914
- for (const account of Object.values(accounts)) {
1914
+ for (const [accountId, account] of Object.entries(accounts)) {
1915
1915
  const bot = asRecord(account);
1916
- if (!bot || typeof bot.appId !== "string" || bot.appId === "") continue;
1917
- bot.botId = bot.appId;
1916
+ const expectedAppId = appIdFromAccountId(accountId);
1917
+ if (!bot || !expectedAppId) continue;
1918
+ bot.appId = expectedAppId;
1918
1919
  }
1919
1920
  }
1920
1921
  };
1921
1922
  FeishuBotIdRule = __decorate([Rule({
1922
1923
  key: "feishu_bot_id",
1923
- description: "确保多账号飞书配置中每个 bot 账号的 botId 与 appId 一致",
1924
+ description: "确保多账号飞书配置中每个 bot-<appId> 账号 key 与 appId 一致",
1924
1925
  dependsOn: ["config_syntax_check", "feishu_default_account"],
1925
1926
  repairMode: "standard"
1926
1927
  })], FeishuBotIdRule);
@@ -1928,15 +1929,19 @@ function getMismatchedAccounts(accounts) {
1928
1929
  const mismatched = [];
1929
1930
  for (const [accountId, account] of Object.entries(accounts)) {
1930
1931
  const bot = asRecord(account);
1931
- if (!bot || typeof bot.appId !== "string" || bot.appId === "") continue;
1932
- if (bot.botId !== bot.appId) mismatched.push(accountId);
1932
+ const expectedAppId = appIdFromAccountId(accountId);
1933
+ if (!bot || !expectedAppId) continue;
1934
+ if (bot.appId !== expectedAppId) mismatched.push(`${accountId} expected appId ${expectedAppId}, got ${String(bot.appId)}`);
1933
1935
  }
1934
1936
  return mismatched;
1935
1937
  }
1938
+ function appIdFromAccountId(accountId) {
1939
+ if (!accountId.startsWith("bot-cli_")) return void 0;
1940
+ return accountId.slice(4);
1941
+ }
1936
1942
  //#endregion
1937
1943
  //#region src/rules/session-persistence.ts
1938
1944
  const DEFAULT_SESSION = {
1939
- dmScope: "per-account-channel-peer",
1940
1945
  resetByChannel: { feishu: {
1941
1946
  mode: "idle",
1942
1947
  idleMinutes: 10080
@@ -1965,7 +1970,6 @@ let SessionPersistenceRule = class SessionPersistenceRule extends DiagnoseRule {
1965
1970
  const needsResetByChannel = !getNestedMap(session, "resetByChannel");
1966
1971
  const needsMaintenance = !getNestedMap(session, "maintenance");
1967
1972
  if (!needsResetByChannel && !needsMaintenance) return;
1968
- session.dmScope = DEFAULT_SESSION.dmScope;
1969
1973
  if (needsResetByChannel) session.resetByChannel = DEFAULT_SESSION.resetByChannel;
1970
1974
  if (needsMaintenance) session.maintenance = DEFAULT_SESSION.maintenance;
1971
1975
  }
@@ -9871,7 +9875,7 @@ async function reportCliRun(opts) {
9871
9875
  //#region src/help.ts
9872
9876
  const BIN = "mclaw-diagnose";
9873
9877
  function versionBanner() {
9874
- return `v0.1.9-alpha.0`;
9878
+ return `v0.1.9-alpha.1`;
9875
9879
  }
9876
9880
  const COMMANDS = [
9877
9881
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/openclaw-scripts-diagnose-cli",
3
- "version": "0.1.9-alpha.0",
3
+ "version": "0.1.9-alpha.1",
4
4
  "description": "CLI for OpenClaw config diagnose and repair with JSON5 support",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {