@dcrays/dcgchat-test 0.1.15 → 0.1.16
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/README.md +2 -2
- package/index.ts +3 -3
- package/openclaw.plugin.json +2 -2
- package/package.json +9 -9
- package/src/bot.ts +5 -5
- package/src/channel.ts +11 -12
- package/src/runtime.ts +1 -1
- package/src/skill.ts +1 -1
package/README.md
CHANGED
package/index.ts
CHANGED
|
@@ -5,9 +5,9 @@ import { setDcgchatRuntime, setWorkspaceDir } from "./src/runtime.js";
|
|
|
5
5
|
import { monitoringToolMessage } from "./src/tool.js";
|
|
6
6
|
|
|
7
7
|
const plugin = {
|
|
8
|
-
id: "dcgchat",
|
|
9
|
-
name: "
|
|
10
|
-
description: "连接 OpenClaw 与
|
|
8
|
+
id: "dcgchat-test",
|
|
9
|
+
name: "书灵墨宝",
|
|
10
|
+
description: "连接 OpenClaw 与 书灵墨宝 产品(WebSocket)",
|
|
11
11
|
configSchema: emptyPluginConfigSchema(),
|
|
12
12
|
register(api: OpenClawPluginApi) {
|
|
13
13
|
setDcgchatRuntime(api.runtime);
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcrays/dcgchat-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "OpenClaw channel plugin for
|
|
5
|
+
"description": "OpenClaw channel plugin for 书灵墨宝 (WebSocket)",
|
|
6
6
|
"main": "index.ts",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"files": [
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"keywords": [
|
|
14
14
|
"openclaw",
|
|
15
|
-
"dcgchat",
|
|
15
|
+
"dcgchat-test",
|
|
16
16
|
"websocket",
|
|
17
17
|
"ai"
|
|
18
18
|
],
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"typecheck": "tsc --noEmit"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
+
"axios": "file:src/libs/axios-1.13.6.tgz",
|
|
23
24
|
"ws": "file:src/libs/ws-8.19.0.tgz",
|
|
24
25
|
"mime-types": "file:src/libs/mime-types-3.0.2.tgz",
|
|
25
26
|
"unzipper": "file:src/libs/unzipper-0.12.3.tgz"
|
|
@@ -29,13 +30,12 @@
|
|
|
29
30
|
"./index.ts"
|
|
30
31
|
],
|
|
31
32
|
"channel": {
|
|
32
|
-
"id": "dcgchat",
|
|
33
|
-
"label": "
|
|
34
|
-
"selectionLabel": "
|
|
33
|
+
"id": "dcgchat-test",
|
|
34
|
+
"label": "书灵墨宝",
|
|
35
|
+
"selectionLabel": "书灵墨宝",
|
|
35
36
|
"docsPath": "/channels/dcgchat",
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
"blurb": "连接 OpenClaw 与 DCG Chat 产品",
|
|
37
|
+
"docsLabel": "dcgchat-test",
|
|
38
|
+
"blurb": "连接 OpenClaw 与 书灵墨宝 产品",
|
|
39
39
|
"order": 80
|
|
40
40
|
},
|
|
41
41
|
"install": {
|
package/src/bot.ts
CHANGED
|
@@ -102,7 +102,7 @@ export async function handleDcgchatMessage(params: {
|
|
|
102
102
|
|
|
103
103
|
const route = core.channel.routing.resolveAgentRoute({
|
|
104
104
|
cfg,
|
|
105
|
-
channel: "dcgchat",
|
|
105
|
+
channel: "dcgchat-test",
|
|
106
106
|
accountId: account.accountId,
|
|
107
107
|
peer: { kind: "direct", id: userId },
|
|
108
108
|
});
|
|
@@ -128,7 +128,7 @@ export async function handleDcgchatMessage(params: {
|
|
|
128
128
|
// const messageBody = `${userId}: ${text}`;
|
|
129
129
|
const messageBody = text;
|
|
130
130
|
const bodyFormatted = core.channel.reply.formatAgentEnvelope({
|
|
131
|
-
channel: "
|
|
131
|
+
channel: "书灵墨宝",
|
|
132
132
|
from: userId,
|
|
133
133
|
timestamp: new Date(),
|
|
134
134
|
envelope: envelopeOptions,
|
|
@@ -146,13 +146,13 @@ export async function handleDcgchatMessage(params: {
|
|
|
146
146
|
ChatType: "direct",
|
|
147
147
|
SenderName: userId,
|
|
148
148
|
SenderId: userId,
|
|
149
|
-
Provider: "dcgchat" as const,
|
|
150
|
-
Surface: "dcgchat" as const,
|
|
149
|
+
Provider: "dcgchat-test" as const,
|
|
150
|
+
Surface: "dcgchat-test" as const,
|
|
151
151
|
MessageSid: msg.content.message_id,
|
|
152
152
|
Timestamp: Date.now(),
|
|
153
153
|
WasMentioned: true,
|
|
154
154
|
CommandAuthorized: true,
|
|
155
|
-
OriginatingChannel: "dcgchat" as const,
|
|
155
|
+
OriginatingChannel: "dcgchat-test" as const,
|
|
156
156
|
OriginatingTo: `user:${userId}`,
|
|
157
157
|
...mediaPayload,
|
|
158
158
|
});
|
package/src/channel.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk";
|
|
|
6
6
|
import type { ResolvedDcgchatAccount, DcgchatConfig } from "./types.js";
|
|
7
7
|
import { logDcgchat } from "./log.js";
|
|
8
8
|
import { getWsConnection } from "./connection.js";
|
|
9
|
-
// import { ossUpload } from "./oss.js";
|
|
10
9
|
import { getMsgParams } from "./tool.js";
|
|
11
10
|
|
|
12
11
|
const uploadRoot = resolve('/', "upload");
|
|
@@ -49,7 +48,7 @@ async function ensureMediaInUploadDir(url: string): Promise<string> {
|
|
|
49
48
|
|
|
50
49
|
export function resolveAccount(cfg: OpenClawConfig, accountId?: string | null): ResolvedDcgchatAccount {
|
|
51
50
|
const id = accountId ?? DEFAULT_ACCOUNT_ID;
|
|
52
|
-
const raw = (cfg.channels?.["dcgchat"] as DcgchatConfig | undefined) ?? {};
|
|
51
|
+
const raw = (cfg.channels?.["dcgchat-test"] as DcgchatConfig | undefined) ?? {};
|
|
53
52
|
return {
|
|
54
53
|
accountId: id,
|
|
55
54
|
enabled: raw.enabled !== false,
|
|
@@ -63,14 +62,14 @@ export function resolveAccount(cfg: OpenClawConfig, accountId?: string | null):
|
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
|
|
66
|
-
id: "dcgchat",
|
|
65
|
+
id: "dcgchat-test",
|
|
67
66
|
meta: {
|
|
68
|
-
id: "dcgchat",
|
|
69
|
-
label: "
|
|
70
|
-
selectionLabel: "
|
|
67
|
+
id: "dcgchat-test",
|
|
68
|
+
label: "书灵墨宝",
|
|
69
|
+
selectionLabel: "书灵墨宝",
|
|
71
70
|
docsPath: "/channels/dcgchat",
|
|
72
|
-
docsLabel: "dcgchat",
|
|
73
|
-
blurb: "连接 OpenClaw 与
|
|
71
|
+
docsLabel: "dcgchat-test",
|
|
72
|
+
blurb: "连接 OpenClaw 与 书灵墨宝 产品",
|
|
74
73
|
order: 80,
|
|
75
74
|
},
|
|
76
75
|
capabilities: {
|
|
@@ -109,8 +108,8 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
|
|
|
109
108
|
...cfg,
|
|
110
109
|
channels: {
|
|
111
110
|
...cfg.channels,
|
|
112
|
-
"dcgchat": {
|
|
113
|
-
...(cfg.channels?.["dcgchat"] as Record<string, unknown> | undefined),
|
|
111
|
+
"dcgchat-test": {
|
|
112
|
+
...(cfg.channels?.["dcgchat-test"] as Record<string, unknown> | undefined),
|
|
114
113
|
enabled,
|
|
115
114
|
},
|
|
116
115
|
},
|
|
@@ -160,7 +159,7 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
|
|
|
160
159
|
logDcgchat.warn(`[dcgchat][${ctx.accountId ?? DEFAULT_ACCOUNT_ID}] outbound -> ${ws?.readyState}: ${ctx.text}`);
|
|
161
160
|
}
|
|
162
161
|
return {
|
|
163
|
-
channel: "dcgchat",
|
|
162
|
+
channel: "dcgchat-test",
|
|
164
163
|
messageId: `dcg-${Date.now()}`,
|
|
165
164
|
chatId: params.userId.toString(),
|
|
166
165
|
};
|
|
@@ -211,7 +210,7 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
|
|
|
211
210
|
logDcgchat.warn(`[dcgchat][${ctx.accountId ?? DEFAULT_ACCOUNT_ID}] outbound -> ${ws?.readyState}: ${ctx.text}`);
|
|
212
211
|
}
|
|
213
212
|
return {
|
|
214
|
-
channel: "dcgchat",
|
|
213
|
+
channel: "dcgchat-test",
|
|
215
214
|
messageId: `dcg-${Date.now()}`,
|
|
216
215
|
chatId: params.userId.toString(),
|
|
217
216
|
};
|
package/src/runtime.ts
CHANGED
|
@@ -34,7 +34,7 @@ export function setDcgchatRuntime(next: PluginRuntime) {
|
|
|
34
34
|
|
|
35
35
|
export function getDcgchatRuntime(): PluginRuntime {
|
|
36
36
|
if (!runtime) {
|
|
37
|
-
throw new Error("
|
|
37
|
+
throw new Error("书灵墨宝 runtime not initialized");
|
|
38
38
|
}
|
|
39
39
|
return runtime;
|
|
40
40
|
}
|
package/src/skill.ts
CHANGED
|
@@ -116,7 +116,7 @@ export async function installSkill(params: ISkillParams, msgContent: Record<stri
|
|
|
116
116
|
reject(err);
|
|
117
117
|
}
|
|
118
118
|
})
|
|
119
|
-
.on("error", (err) => {
|
|
119
|
+
.on("error", (err: { message: any; }) => {
|
|
120
120
|
hasError = true;
|
|
121
121
|
reject(new Error(`解压流错误: ${err.message}`));
|
|
122
122
|
});
|