openclaw-channel-dmwork 0.2.4 → 0.2.6
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/package.json +4 -4
- package/src/inbound.ts +22 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-channel-dmwork",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "DMWork channel plugin for OpenClaw via WuKongIM WebSocket",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"axios": "^1.7.0",
|
|
18
18
|
"ws": "^8.16.0",
|
|
19
|
-
"wukongimjssdk": "^1.3.4"
|
|
20
|
-
"zod": "^4.0.0"
|
|
19
|
+
"wukongimjssdk": "^1.3.4"
|
|
21
20
|
},
|
|
22
21
|
"peerDependencies": {
|
|
23
|
-
"openclaw": ">=2026.2.0"
|
|
22
|
+
"openclaw": ">=2026.2.0",
|
|
23
|
+
"zod": ">=3.0.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/ws": "^8.5.10",
|
package/src/inbound.ts
CHANGED
|
@@ -10,17 +10,28 @@ let recordPendingHistoryEntryIfEnabled: any;
|
|
|
10
10
|
let buildPendingHistoryContextFromMap: any;
|
|
11
11
|
let clearHistoryEntriesIfEnabled: any;
|
|
12
12
|
let DEFAULT_GROUP_HISTORY_LIMIT = 20;
|
|
13
|
+
let _sdkLoaded = false;
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
async function ensureSdkLoaded() {
|
|
16
|
+
if (_sdkLoaded) return;
|
|
17
|
+
_sdkLoaded = true;
|
|
18
|
+
try {
|
|
19
|
+
const sdk = await import("openclaw/plugin-sdk");
|
|
20
|
+
if (typeof sdk.recordPendingHistoryEntryIfEnabled === "function") {
|
|
21
|
+
recordPendingHistoryEntryIfEnabled = sdk.recordPendingHistoryEntryIfEnabled;
|
|
22
|
+
}
|
|
23
|
+
if (typeof sdk.buildPendingHistoryContextFromMap === "function") {
|
|
24
|
+
buildPendingHistoryContextFromMap = sdk.buildPendingHistoryContextFromMap;
|
|
25
|
+
}
|
|
26
|
+
if (typeof sdk.clearHistoryEntriesIfEnabled === "function") {
|
|
27
|
+
clearHistoryEntriesIfEnabled = sdk.clearHistoryEntriesIfEnabled;
|
|
28
|
+
}
|
|
29
|
+
if (sdk.DEFAULT_GROUP_HISTORY_LIMIT) {
|
|
30
|
+
DEFAULT_GROUP_HISTORY_LIMIT = sdk.DEFAULT_GROUP_HISTORY_LIMIT;
|
|
31
|
+
}
|
|
32
|
+
} catch {
|
|
33
|
+
// Older OpenClaw versions may not export these — fallback implementations used
|
|
21
34
|
}
|
|
22
|
-
} catch {
|
|
23
|
-
// Older OpenClaw versions may not export these
|
|
24
35
|
}
|
|
25
36
|
|
|
26
37
|
|
|
@@ -55,6 +66,8 @@ export async function handleInboundMessage(params: {
|
|
|
55
66
|
}) {
|
|
56
67
|
const { account, message, botUid, groupHistories, log, statusSink } = params;
|
|
57
68
|
|
|
69
|
+
await ensureSdkLoaded();
|
|
70
|
+
|
|
58
71
|
const isGroup =
|
|
59
72
|
typeof message.channel_id === "string" &&
|
|
60
73
|
message.channel_id.length > 0 &&
|