@claw-camp/openclaw-plugin 2.0.2 → 2.0.3

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/index.ts +2 -34
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -632,37 +632,8 @@ export default function (api: OpenClawPluginApi) {
632
632
 
633
633
  const channels = new Map<string, ClawCampChannel>();
634
634
 
635
- // 直接启动渠道连接(兼容旧路径,gateway.startAccount 有时不触发)
636
- const startChannels = () => {
637
- const accounts = config.channels?.['claw-camp']?.accounts || {};
638
- const accountKeys = Object.keys(accounts);
639
- if (accountKeys.length === 0) {
640
- logger.warn('[Claw Camp] 未配置 accounts,跳过连接');
641
- return;
642
- }
643
- for (const accountKey of accountKeys) {
644
- if (channels.has(accountKey)) continue; // 已由 gateway.startAccount 启动,跳过
645
- const accountConfig = accounts[accountKey];
646
- const { botId, botToken } = accountConfig;
647
- if (botId && botToken) {
648
- const agentName = accountConfig.agentName || accountKey;
649
- logger.info(`[Claw Camp] 启动连接: botId=${botId}, name=${agentName}`);
650
- const channel = new ClawCampChannel(api, {
651
- hubUrl: 'wss://camp.aigc.sx.cn/ws',
652
- token: botToken,
653
- agentId: botId,
654
- agentName,
655
- accountId: accountKey,
656
- botId,
657
- botToken,
658
- });
659
- channels.set(accountKey, channel);
660
- channel.connect();
661
- } else {
662
- logger.warn(`[Claw Camp] account ${accountKey} 缺少 botId/botToken`);
663
- }
664
- }
665
- };
635
+ // 注意:channelRuntime 通过 gateway.startAccount 传入
636
+ // 如果 startAccount 没被调用,channelRuntime 将不可用
666
637
 
667
638
  const stopAllChannels = () => {
668
639
  logger.info(`[Claw Camp] 停止 ${channels.size} 个连接...`);
@@ -678,9 +649,6 @@ export default function (api: OpenClawPluginApi) {
678
649
  process.once('SIGINT', stopAllChannels);
679
650
  api.on?.('shutdown', stopAllChannels);
680
651
 
681
- // 延迟 2s 启动(等 Gateway 就绪)
682
- setTimeout(startChannels, 2000);
683
-
684
652
  // 注册渠道
685
653
  if (api.registerChannel) {
686
654
  api.registerChannel({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claw-camp/openclaw-plugin",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Claw Camp plugin for OpenClaw - monitor your AI agents in real-time",
5
5
  "main": "index.ts",
6
6
  "keywords": ["openclaw", "plugin", "monitoring", "agent", "claw-camp"],