@dcrays/dcgchat-test 0.3.1 → 0.3.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/index.ts CHANGED
@@ -13,10 +13,8 @@ const plugin = {
13
13
  configSchema: emptyPluginConfigSchema(),
14
14
  register(api: OpenClawPluginApi) {
15
15
  setDcgchatRuntime(api.runtime)
16
-
17
16
  monitoringToolMessage(api)
18
17
  setOpenClawConfig(api.config)
19
- startDcgchatGatewaySocket()
20
18
  api.registerChannel({ plugin: dcgchatPlugin })
21
19
  setWorkspaceDir(api.config?.agents?.defaults?.workspace)
22
20
  api.registerTool((ctx) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcrays/dcgchat-test",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "description": "OpenClaw channel plugin for 书灵墨宝 (WebSocket)",
6
6
  "main": "index.ts",
package/src/channel.ts CHANGED
@@ -6,6 +6,7 @@ import { addSentMediaKey, getOpenClawConfig, hasSentMediaKey } from './utils/glo
6
6
  import { isWsOpen, mergeDefaultParams, mergeSessionParams, sendFinal, wsSendRaw } from './transport.js'
7
7
  import { dcgLogger, setLogger } from './utils/log.js'
8
8
  import { getParamsDefaults, getEffectiveMsgParams, getCurrentSessionKey } from './utils/params.js'
9
+ import { startDcgchatGatewaySocket } from './gateway/socket.js'
9
10
 
10
11
  export type DcgchatMediaSendOptions = {
11
12
  /** 与 setParamsMessage / map 一致,用于 getEffectiveMsgParams */
@@ -177,6 +178,7 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
177
178
  dcgLogger(`dcgchat[${account.accountId}]: wsUrl not configured, skipping`, 'error')
178
179
  return
179
180
  }
181
+ startDcgchatGatewaySocket()
180
182
  return monitorDcgchatProvider({
181
183
  config: ctx.cfg,
182
184
  runtime: ctx.runtime,
@@ -216,7 +216,7 @@ export class GatewayConnection {
216
216
  })
217
217
 
218
218
  this.ws.on('error', (err) => {
219
- console.log('🚀 ~ GatewayConnection ~ connect ~ err:', err)
219
+ dcgLogger(`Gateway 连接错误: ${err}`, 'error')
220
220
  finishHandshake(() => reject(err))
221
221
  })
222
222
  })
package/src/tool.ts CHANGED
@@ -88,7 +88,7 @@ export function monitoringToolMessage(api: OpenClawPluginApi) {
88
88
  if (status === 'running') {
89
89
  if (['after_tool_call', 'before_tool_call'].includes(item.event)) {
90
90
  const { result: _result, ...rest } = event
91
- dcgLogger(`工具调用结果: ~ event:${item.event} ~ params:${JSON.stringify(rest)}, args: ${JSON.stringify(args)}`)
91
+ dcgLogger(`工具调用结果: ~ event:${item.event} ~ params:${JSON.stringify(rest)}`)
92
92
  const text = JSON.stringify({
93
93
  type: item.event,
94
94
  specialIdentification: 'dcgchat_tool_call_special_identification',
@@ -100,7 +100,6 @@ export function monitoringToolMessage(api: OpenClawPluginApi) {
100
100
  } else if (item.event) {
101
101
  dcgLogger(`工具调用结果: ~ event:${item.event}`)
102
102
  if (item.event === 'llm_output') {
103
- dcgLogger(`llm_output工具调用结果: ~ event:${JSON.stringify(event)}, args: ${JSON.stringify(args)}`)
104
103
  if (event.lastAssistant?.errorMessage === '429-账户额度耗尽') {
105
104
  const message = '您的积分已消耗完,您可以通过充值积分来继续使用'
106
105
  const sk = ((args?.sessionKey as string | undefined) ?? getCurrentSessionKey()) || ''