@dcrays/dcgchat-test 0.2.5 → 0.2.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcrays/dcgchat-test",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "type": "module",
5
5
  "description": "OpenClaw channel plugin for 书灵墨宝 (WebSocket)",
6
6
  "main": "index.ts",
package/src/channel.ts CHANGED
@@ -119,6 +119,22 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
119
119
  },
120
120
  };
121
121
  ws.send(JSON.stringify(content));
122
+ ws.send(JSON.stringify({
123
+ messageType: "openclaw_bot_chat",
124
+ _userId: params.userId,
125
+ source: "client",
126
+ content: {
127
+ bot_token: botToken,
128
+ domain_id: params.domainId,
129
+ app_id: params.appId,
130
+ bot_id: params.botId,
131
+ agent_id: params.agentId,
132
+ ssession_id: params.sessionId,
133
+ message_id: params.messageId || Date.now().toString(),
134
+ response: '',
135
+ state: 'final',
136
+ },
137
+ }));
122
138
  log(`dcgchat[${ctx.accountId}]: sendText to ${params.userId}, ${JSON.stringify(content)}`);
123
139
  } else {
124
140
  log(`[dcgchat][${ctx.accountId ?? DEFAULT_ACCOUNT_ID}] outbound -> ${ws?.readyState}: ${ctx.text}`);
@@ -180,6 +196,22 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
180
196
  },
181
197
  };
182
198
  ws.send(JSON.stringify(content));
199
+ ws.send(JSON.stringify({
200
+ messageType: "openclaw_bot_chat",
201
+ _userId: params.userId,
202
+ source: "client",
203
+ content: {
204
+ bot_token: botToken,
205
+ domain_id: params.domainId,
206
+ app_id: params.appId,
207
+ bot_id: params.botId,
208
+ agent_id: params.agentId,
209
+ ssession_id: params.sessionId,
210
+ message_id: params.messageId || Date.now().toString(),
211
+ response: '',
212
+ state: 'final',
213
+ },
214
+ }));
183
215
  log(`dcgchat[${ctx.accountId}]: error sendMedia to ${params.userId}, ${JSON.stringify(content)}`);
184
216
  }
185
217
  } else {
package/src/skill.ts CHANGED
@@ -136,7 +136,7 @@ export function uninstallSkill(params: Omit<ISkillParams, 'path'>, msgContent: R
136
136
 
137
137
  const workspacePath = getWorkspaceDir();
138
138
  if (!workspacePath) {
139
- throw new Error('未找到工作区路径');
139
+ sendEvent({ ...msgContent, status: 'ok' })
140
140
  }
141
141
 
142
142
  const skillDir = path.join(workspacePath, 'skills', code);
@@ -145,6 +145,6 @@ export function uninstallSkill(params: Omit<ISkillParams, 'path'>, msgContent: R
145
145
  fs.rmSync(skillDir, { recursive: true, force: true });
146
146
  sendEvent({ ...msgContent, status: 'ok' })
147
147
  } else {
148
- sendEvent({ ...msgContent, status: 'fail' })
148
+ sendEvent({ ...msgContent, status: 'ok' })
149
149
  }
150
150
  }