@wecom/wecom-openclaw-plugin 2026.4.7-beta.1 → 2026.4.7-beta.2
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/const.d.ts +2 -0
- package/dist/src/const.js +2 -0
- package/dist/src/runtime.d.ts +2 -2
- package/dist/src/runtime.js +3 -10
- package/dist/src/state-manager.js +3 -2
- package/package.json +1 -1
package/dist/src/const.d.ts
CHANGED
|
@@ -38,6 +38,8 @@ export declare const MESSAGE_STATE_TTL_MS: number;
|
|
|
38
38
|
export declare const MESSAGE_STATE_CLEANUP_INTERVAL_MS = 60000;
|
|
39
39
|
/** messageStates Map 最大条目数 */
|
|
40
40
|
export declare const MESSAGE_STATE_MAX_SIZE = 500;
|
|
41
|
+
/** WebSocket 全局实例键 */
|
|
42
|
+
export declare const GLOBAL_WS_CLIENT_KEY: "__wecom_openclaw_ws_client_instances";
|
|
41
43
|
/** "思考中"流式消息占位内容 */
|
|
42
44
|
export declare const THINKING_MESSAGE = "<think></think>";
|
|
43
45
|
/** 仅包含图片时的消息占位符 */
|
package/dist/src/const.js
CHANGED
|
@@ -45,6 +45,8 @@ export const MESSAGE_STATE_TTL_MS = 10 * 60 * 1000;
|
|
|
45
45
|
export const MESSAGE_STATE_CLEANUP_INTERVAL_MS = 60_000;
|
|
46
46
|
/** messageStates Map 最大条目数 */
|
|
47
47
|
export const MESSAGE_STATE_MAX_SIZE = 500;
|
|
48
|
+
/** WebSocket 全局实例键 */
|
|
49
|
+
export const GLOBAL_WS_CLIENT_KEY = "__wecom_openclaw_ws_client_instances";
|
|
48
50
|
// ============================================================================
|
|
49
51
|
// 消息模板
|
|
50
52
|
// ============================================================================
|
package/dist/src/runtime.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PluginRuntime } from "openclaw/plugin-sdk/core";
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
declare const setWeComRuntime: (next: PluginRuntime) => void, getWeComRuntime: () => PluginRuntime;
|
|
3
|
+
export { setWeComRuntime, getWeComRuntime };
|
package/dist/src/runtime.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
export function getWeComRuntime() {
|
|
6
|
-
if (!runtime) {
|
|
7
|
-
throw new Error("WeCom runtime not initialized - plugin not registered");
|
|
8
|
-
}
|
|
9
|
-
return runtime;
|
|
10
|
-
}
|
|
1
|
+
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
2
|
+
const { setRuntime: setWeComRuntime, getRuntime: getWeComRuntime } = createPluginRuntimeStore("WeCom runtime not initialized");
|
|
3
|
+
export { setWeComRuntime, getWeComRuntime };
|
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
* 解决全局 Map 的内存泄漏问题
|
|
6
6
|
*/
|
|
7
7
|
import { createPersistentReqIdStore } from "./reqid-store.js";
|
|
8
|
-
import { MESSAGE_STATE_TTL_MS, MESSAGE_STATE_CLEANUP_INTERVAL_MS, MESSAGE_STATE_MAX_SIZE, } from "./const.js";
|
|
8
|
+
import { MESSAGE_STATE_TTL_MS, MESSAGE_STATE_CLEANUP_INTERVAL_MS, MESSAGE_STATE_MAX_SIZE, GLOBAL_WS_CLIENT_KEY, } from "./const.js";
|
|
9
9
|
// ============================================================================
|
|
10
10
|
// WSClient 实例管理
|
|
11
11
|
// ============================================================================
|
|
12
12
|
/** WSClient 实例管理 */
|
|
13
|
-
const wsClientInstances =
|
|
13
|
+
const wsClientInstances = (globalThis[GLOBAL_WS_CLIENT_KEY]
|
|
14
|
+
?? (globalThis[GLOBAL_WS_CLIENT_KEY] = new Map()));
|
|
14
15
|
/**
|
|
15
16
|
* 获取指定账户的 WSClient 实例
|
|
16
17
|
*/
|