@ynhcj/xiaoyi-channel 0.0.80-next → 0.0.81-next
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/src/client.js +7 -1
- package/dist/src/task-manager.js +6 -1
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -12,8 +12,14 @@ export function setClientRuntime(rt) {
|
|
|
12
12
|
/**
|
|
13
13
|
* Global cache for WebSocket managers.
|
|
14
14
|
* Key format: `${apiKey}-${agentId}`
|
|
15
|
+
* Uses globalThis to ensure a single cache across all module copies
|
|
16
|
+
* (same fix as session-manager.ts for openclaw multi-instance loading).
|
|
15
17
|
*/
|
|
16
|
-
const
|
|
18
|
+
const _g = globalThis;
|
|
19
|
+
if (!_g.__xyWsManagerCache) {
|
|
20
|
+
_g.__xyWsManagerCache = new Map();
|
|
21
|
+
}
|
|
22
|
+
const wsManagerCache = _g.__xyWsManagerCache;
|
|
17
23
|
/**
|
|
18
24
|
* Get or create a WebSocket manager for the given configuration.
|
|
19
25
|
* Reuses existing managers if config matches.
|
package/dist/src/task-manager.js
CHANGED
|
@@ -5,8 +5,13 @@ import { logger } from "./utils/logger.js";
|
|
|
5
5
|
* Session到活跃TaskId的映射
|
|
6
6
|
* Key: sessionId (注意:这里用sessionId,不是sessionKey)
|
|
7
7
|
* Value: TaskIdBinding
|
|
8
|
+
* Uses globalThis to ensure a single Map across all module copies.
|
|
8
9
|
*/
|
|
9
|
-
const
|
|
10
|
+
const _g = globalThis;
|
|
11
|
+
if (!_g.__xyActiveTaskIds) {
|
|
12
|
+
_g.__xyActiveTaskIds = new Map();
|
|
13
|
+
}
|
|
14
|
+
const activeTaskIds = _g.__xyActiveTaskIds;
|
|
10
15
|
/**
|
|
11
16
|
* 注册或更新session的活跃taskId
|
|
12
17
|
* 返回是否是更新(用于判断是否是第二条消息)
|