rol-websocket-channel 1.8.7 → 1.8.9

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/dist/index.js CHANGED
@@ -573,6 +573,7 @@ async function handleIncomingMessage(payload, account, cfg, runtime, log, mqttTo
573
573
  });
574
574
  // 用户传参覆盖自动路由结果
575
575
  const resolvedAccountId = targetAgentId ?? route.accountId;
576
+ //
576
577
  const resolvedSessionKey = targetSessionId ?? route.sessionKey;
577
578
  // 缓存最新请求上下文(双键:sessionKey 和 senderId)
578
579
  sessionContextMap.set(resolvedSessionKey, { traceId, agentId: resolvedAccountId });
@@ -649,7 +650,7 @@ async function handleIncomingMessage(payload, account, cfg, runtime, log, mqttTo
649
650
  log?.error(`[rol-websocket-channel] Failed to process message: ${err instanceof Error ? err.message : String(err)}`);
650
651
  }
651
652
  }
652
- const immediateAckMessageTypes = new Set(["pluginSelfUpdate"]);
653
+ const immediateAckMessageTypes = new Set(["pluginSelfUpdate", "expertsSync"]);
653
654
  export async function handleCustomMessageType(msgType, innerData, traceId, accountId, mqttTopic) {
654
655
  const isSkillInstallFlow = msgType === "skillsInstallFromClawHub" || msgType === "skillsUpdateFromClawHub";
655
656
  const response = {
@@ -16,6 +16,7 @@ import { getUsagePageSummary, getUsageTimeseries, getUsageBreakdown, getUsageSum
16
16
  import { listInstalledSkills, installSkillFromNpm, searchClawHubSkills, installSkillFromClawHub, updateSkillFromClawHub } from './src/admin/methods/skills.js';
17
17
  import { uninstallSkill } from './src/admin/methods/skills-extended.js';
18
18
  import { toggleSkill } from './src/admin/methods/skills-toggle.js';
19
+ import { syncExperts } from './src/admin/methods/experts.js';
19
20
  import { listMemoryFiles, getMemoryFile, backupMemory, exportMemoryZip, getMemoryPresignedPost, createMemoryBackupRecord, importMemoryZip, } from './src/admin/methods/memory.js';
20
21
  import { getMem9Config, installMem9, reconnectMem9 } from './src/admin/methods/mem9.js';
21
22
  import { currentVersion, doctorFix, logs, pluginSelfUpdate, restart, stop } from './src/admin/methods/system.js';
@@ -331,6 +332,12 @@ export class MessageHandler {
331
332
  return await toggleSkill(data, context);
332
333
  });
333
334
  }
335
+ async expertsSync(data) {
336
+ return wrapAdminCall(async () => {
337
+ const context = getContext();
338
+ return await syncExperts(data, context);
339
+ });
340
+ }
334
341
  /**
335
342
  * 列出 memory 文件
336
343
  */
@@ -2,7 +2,8 @@ import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  export async function readJsonFile(filePath) {
4
4
  const raw = await fs.readFile(filePath, 'utf8');
5
- return JSON.parse(raw);
5
+ const json = raw.charCodeAt(0) === 0xfeff ? raw.slice(1) : raw;
6
+ return JSON.parse(json);
6
7
  }
7
8
  export async function writeJsonFile(filePath, data) {
8
9
  const json = JSON.stringify(data, null, 2);