@dcrays/dcgchat-test 0.1.12 → 0.1.13

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.
Files changed (2) hide show
  1. package/package.json +11 -1
  2. package/src/channel.ts +6 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcrays/dcgchat-test",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "type": "module",
5
5
  "description": "OpenClaw channel plugin for DCG Chat (WebSocket)",
6
6
  "main": "index.ts",
@@ -24,6 +24,16 @@
24
24
  "mime-types": "file:src/libs/mime-types-3.0.2.tgz",
25
25
  "unzipper": "file:src/libs/unzipper-0.12.3.tgz"
26
26
  },
27
+ "devDependencies": {
28
+ "@types/node": "^22.0.0",
29
+ "@types/ws": "^8.5.0",
30
+ "openclaw": "2026.2.13",
31
+ "tsx": "^4.19.0",
32
+ "typescript": "^5.7.0"
33
+ },
34
+ "peerDependencies": {
35
+ "openclaw": ">=2026.2.13"
36
+ },
27
37
  "openclaw": {
28
38
  "extensions": [
29
39
  "./index.ts"
package/src/channel.ts CHANGED
@@ -143,14 +143,13 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
143
143
  // textChunkLimit: 25,
144
144
  textChunkLimit: 4000,
145
145
  sendText: async (ctx) => {
146
- const target = ctx.to || "(implicit)";
147
146
  const ws = getWsConnection()
148
147
  const params = getMsgParams();
149
148
  if (ws?.readyState === WebSocket.OPEN) {
150
149
  const {botToken} = resolveAccount(ctx.cfg, ctx.accountId);
151
150
  const content = {
152
151
  messageType: "openclaw_bot_chat",
153
- _userId: target,
152
+ _userId: params.userId,
154
153
  source: "client",
155
154
  content: {
156
155
  bot_token: botToken,
@@ -160,18 +159,17 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
160
159
  },
161
160
  };
162
161
  ws.send(JSON.stringify(content));
163
- logDcgchat.info(`dcgchat[${ctx.accountId}]: sendText to ${target}, ${JSON.stringify(content)}`);
162
+ logDcgchat.info(`dcgchat[${ctx.accountId}]: sendText to ${params.userId}, ${JSON.stringify(content)}`);
164
163
  } else {
165
164
  logDcgchat.warn(`[dcgchat][${ctx.accountId ?? DEFAULT_ACCOUNT_ID}] outbound -> ${ws?.readyState}: ${ctx.text}`);
166
165
  }
167
166
  return {
168
167
  channel: "dcgchat",
169
168
  messageId: `dcg-${Date.now()}`,
170
- chatId: target,
169
+ chatId: params.userId.toString(),
171
170
  };
172
171
  },
173
172
  sendMedia: async (ctx) => {
174
- const target = ctx.to || "(implicit)";
175
173
  const ws = getWsConnection()
176
174
  const params = getMsgParams();
177
175
 
@@ -183,7 +181,7 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
183
181
  const fileName = url?.split(/[\\/]/).pop() || ''
184
182
  const content = {
185
183
  messageType: "openclaw_bot_chat",
186
- _userId: target,
184
+ _userId: params.userId,
187
185
  source: "client",
188
186
  content: {
189
187
  bot_token: botToken,
@@ -197,8 +195,7 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
197
195
  },
198
196
  };
199
197
  ws.send(JSON.stringify(content));
200
- logDcgchat.info(`dcgchat[${ctx.accountId}]: agent sendMedia to ${target}, ${JSON.stringify(content)}`);
201
- logDcgchat.info(`dcgchat[${ctx.accountId}]: agent ctx to ${target}, ${JSON.stringify(ctx)}`);
198
+ logDcgchat.info(`dcgchat[${ctx.accountId}]: agent sendMedia to ${params.userId}, ${JSON.stringify(content)}`);
202
199
  // } catch (error) {
203
200
  // const content = {
204
201
  // messageType: "openclaw_bot_chat",
@@ -220,7 +217,7 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
220
217
  return {
221
218
  channel: "dcgchat",
222
219
  messageId: `dcg-${Date.now()}`,
223
- chatId: target,
220
+ chatId: params.userId.toString(),
224
221
  };
225
222
  },
226
223
  },