@dcrays/dcgchat 0.3.28 → 0.3.29

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",
3
- "version": "0.3.28",
3
+ "version": "0.3.29",
4
4
  "type": "module",
5
5
  "description": "OpenClaw channel plugin for 书灵墨宝 (WebSocket)",
6
6
  "main": "index.ts",
package/src/channel.ts CHANGED
@@ -43,14 +43,14 @@ export async function sendDcgchatMedia(opts: DcgchatMediaSendOptions): Promise<v
43
43
  message_tags: { source: 'file' },
44
44
  files: [{ url, name: fileName }]
45
45
  })
46
- dcgLogger(`dcgchat: sendMedia to user ${msgCtx.userId}, file=${fileName}`)
46
+ dcgLogger(`dcgchat: sendMedia session=${opts.sessionKey}, file=${fileName}`)
47
47
  } catch (error) {
48
48
  wsSendRaw(msgCtx, {
49
49
  response: opts.text ?? '',
50
50
  message_tags: { source: 'file' },
51
51
  files: [{ url: opts.mediaUrl ?? '', name: fileName }]
52
52
  })
53
- dcgLogger(`dcgchat: error sendMedia to user ${msgCtx.userId}: ${String(error)}`, 'error')
53
+ dcgLogger(`dcgchat: error sendMedia session=${opts.sessionKey}: ${String(error)}`, 'error')
54
54
  }
55
55
  }
56
56
 
@@ -138,7 +138,7 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
138
138
  normalizeTarget: (raw) => raw?.trim() || undefined,
139
139
  targetResolver: {
140
140
  looksLikeId: (raw) => Boolean(raw?.trim()),
141
- hint: 'userId'
141
+ hint: 'effectiveSessionKey'
142
142
  }
143
143
  },
144
144
  outbound: {
@@ -186,7 +186,7 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
186
186
  return {
187
187
  channel: "dcgchat",
188
188
  messageId: `${messageId}`,
189
- chatId: msgCtx.userId?.toString()
189
+ chatId: to
190
190
  }
191
191
  }
192
192
  },
@@ -47,8 +47,8 @@ export function getEffectiveMsgParams(sessionKey?: string): IMsgParams {
47
47
  }
48
48
 
49
49
  /**
50
- * Agent `message` 工具常把 `target` 设为用户 ID(如 "150"),而 `setParamsMessage` 使用的 key 是
51
- * `effectiveSessionKey`(如 `agent:main:mobook:direct:...`)。若按 preferredKey 查不到 map,
50
+ * Agent `message` 工具的 `target` 应为 `effectiveSessionKey`(如 `agent:main:mobook:direct:...`)。
51
+ * `setParamsMessage` 使用的 key 与此一致。若按 preferredKey 查不到 map,
52
52
  * 则回落到当前会话 `currentSessionKey`,避免拿到空 `messageId` / `sessionId` 导致无文件卡片、WS 上下文错误。
53
53
  */
54
54
  export function getOutboundMsgParams(preferredKey: string): IMsgParams {