lobster-roundtable 3.0.3 → 3.0.4

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/main.js CHANGED
@@ -60,7 +60,7 @@ try {
60
60
  }
61
61
 
62
62
  const CHANNEL_ID = "lobster-roundtable";
63
- const PLUGIN_VERSION = "3.0.3";
63
+ const PLUGIN_VERSION = "3.0.4";
64
64
  const ENABLE_OPENCLAW_CONFIG_SYNC = isOpenClawConfigSyncEnabled();
65
65
  const OPENCLAW_CONFIG_ALLOWED_KEYS = new Set(["url", "token", "ownerToken", "name", "persona", "maxTokens"]);
66
66
 
@@ -322,6 +322,7 @@ module.exports = async function initRoundtable(api, core, hasRuntimeAPI) {
322
322
  const configuredName = String(cfg.name || "").trim();
323
323
  let token = String(cfg.token || "").trim();
324
324
  let ownerToken = normalizeIdentityId(cfg.ownerToken, 128);
325
+ let tokenSource = token ? 'config' : 'none'; // 追踪 token 来源
325
326
  const persona = String(cfg.persona || "").trim();
326
327
  const maxTokens = cfg.maxTokens || 150;
327
328
 
@@ -370,12 +371,15 @@ module.exports = async function initRoundtable(api, core, hasRuntimeAPI) {
370
371
  } else {
371
372
  api.logger.warn("[roundtable] ⚠️ 检测到配置 token 与本地缓存不一致,优先使用缓存 token");
372
373
  token = cachedToken;
374
+ tokenSource = 'cache';
373
375
  }
374
376
  } else if (cachedToken && !token) {
375
377
  api.logger.info("[roundtable] 📦 从本地缓存加载 token");
376
378
  token = cachedToken;
379
+ tokenSource = 'cache';
377
380
  } else if (cachedToken && token === cachedToken) {
378
381
  api.logger.info("[roundtable] 📦 命中本地 token 缓存");
382
+ tokenSource = 'config+cache';
379
383
  }
380
384
 
381
385
  const cachedOwnerToken = normalizeIdentityId(readTextSafe(ownerTokenCacheFile), 128);
@@ -398,6 +402,7 @@ module.exports = async function initRoundtable(api, core, hasRuntimeAPI) {
398
402
  });
399
403
  if (resp.token) {
400
404
  token = resp.token;
405
+ tokenSource = 'auto-register';
401
406
  if (resp.ownerToken) ownerToken = normalizeIdentityId(resp.ownerToken, 128) || ownerToken;
402
407
  api.logger.info(`[roundtable] 🔑 自动注册成功!名称: ${resp.name}${resp.reused ? '(复用)' : '(新建)'}`);
403
408
  writeTextSafe(tokenCacheFile, token);
@@ -424,7 +429,7 @@ module.exports = async function initRoundtable(api, core, hasRuntimeAPI) {
424
429
  if (!ENABLE_OPENCLAW_CONFIG_SYNC) {
425
430
  api.logger.info("[roundtable] 配置同步已禁用:仅写本地 token 缓存,避免触发 gateway 重启");
426
431
  }
427
- api.logger.info(`[roundtable] v${PLUGIN_VERSION} 启动(Channel 模式)`);
432
+ api.logger.info(`[roundtable] v${PLUGIN_VERSION} 启动(Channel 模式)token=${token ? token.slice(0, 8) + '...' : '无'} source=${tokenSource}`);
428
433
  return startBot(api, core, cfg, wsUrl, token, persona, maxTokens, tokenCacheFile, {
429
434
  ocHome,
430
435
  instanceId,
@@ -434,6 +439,7 @@ module.exports = async function initRoundtable(api, core, hasRuntimeAPI) {
434
439
  wsScope,
435
440
  ownerToken,
436
441
  ownerTokenCacheFile,
442
+ tokenSource,
437
443
  });
438
444
  };
439
445
 
@@ -479,6 +485,7 @@ function startBot(api, core, cfg, wsUrl, token, persona, maxTokens, tokenCacheFi
479
485
  normalizeIdentityId(readTextSafe(ownerTokenCacheFile), 128);
480
486
  let instanceId = normalizeIdentityId(identityCtx.instanceId) || normalizeIdentityId(readTextSafe(instanceIdFile)) || cryptoModule.randomBytes(18).toString("hex");
481
487
  const sessionId = normalizeIdentityId(identityCtx.sessionId, 120) || cryptoModule.randomBytes(12).toString("hex");
488
+ const tokenSource = identityCtx.tokenSource || 'unknown';
482
489
  let recoveringToken = false;
483
490
 
484
491
  // Token 冲突熔断器:防止无限重试导致日志爆炸和 CPU 空转
@@ -771,7 +778,10 @@ function startBot(api, core, cfg, wsUrl, token, persona, maxTokens, tokenCacheFi
771
778
  sessionId,
772
779
  skillNames: installedSkills,
773
780
  roomId: rejoinRoom || undefined,
781
+ pluginVersion: PLUGIN_VERSION,
782
+ tokenSource: tokenSource || 'unknown',
774
783
  });
784
+ api.logger.info(`[roundtable] 🔗 bot_connect 已发送 (token=${token.slice(0, 8)}... source=${tokenSource || 'unknown'})`);
775
785
  };
776
786
 
777
787
  ws.onmessage = async (event) => {
@@ -1611,6 +1621,23 @@ function startBot(api, core, cfg, wsUrl, token, persona, maxTokens, tokenCacheFi
1611
1621
  api.logger.info(
1612
1622
  `[roundtable] 🦞 已连接大厅,待机中。可用房间: ${(msg.rooms || []).map(r => r.id).join(', ')}`
1613
1623
  );
1624
+ // ═══ 连接健康报告 ═══
1625
+ api.logger.info([
1626
+ `[roundtable] ═══ 连接健康报告 ═══`,
1627
+ ` 插件版本: v${PLUGIN_VERSION}`,
1628
+ ` Bot 名称: ${myName}`,
1629
+ ` Token: ${token ? token.slice(0, 8) + '...' : '无'}`,
1630
+ ` Token 来源: ${tokenSource}`,
1631
+ ` Instance: ${instanceId ? instanceId.slice(0, 8) + '...' : '无'}`,
1632
+ ` Session: ${sessionId ? sessionId.slice(0, 8) + '...' : '无'}`,
1633
+ ` 服务端地址: ${wsUrl}`,
1634
+ ` 服务端确认名: ${msg.name || '(未返回)'}`,
1635
+ ` 服务端时间: ${msg.serverTime || '(未返回)'}`,
1636
+ ` 可用房间: ${(msg.rooms || []).length} 个`,
1637
+ ` Runtime API: ${core?.channel?.reply ? '✅' : '❌ (HTTP 降级)'}`,
1638
+ ` 状态: ✅ 在线`,
1639
+ `[roundtable] ═══════════════════`,
1640
+ ].join('\n'));
1614
1641
  rememberFact('回到大厅待机');
1615
1642
  send({ type: 'bot_status', status: 'lobby', text: '☕ 大厅待机中' });
1616
1643
  if (autonomyEnabled) scheduleAutonomyTick(900);
@@ -5,7 +5,7 @@
5
5
  "lobster-roundtable"
6
6
  ],
7
7
  "description": "Connect OpenClaw to the Lobster Roundtable service.",
8
- "version": "3.0.3",
8
+ "version": "3.0.4",
9
9
  "configSchema": {
10
10
  "type": "object",
11
11
  "additionalProperties": false,
@@ -67,4 +67,4 @@
67
67
  "placeholder": "龙虾"
68
68
  }
69
69
  }
70
- }
70
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lobster-roundtable",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "description": "🦞 龙虾圆桌 OpenClaw 标准 Channel 插件 - 让你的 AI 自动参与多智能体圆桌讨论",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -41,4 +41,4 @@
41
41
  "optional": true
42
42
  }
43
43
  }
44
- }
44
+ }