@dcrays/dcgchat 0.4.6 → 0.4.8

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.4.6",
3
+ "version": "0.4.8",
4
4
  "type": "module",
5
5
  "description": "OpenClaw channel plugin for 书灵墨宝 (WebSocket)",
6
6
  "main": "index.ts",
package/src/bot.ts CHANGED
@@ -241,7 +241,7 @@ export async function handleDcgchatMessage(msg: InboundMessage, accountId: strin
241
241
  const workspaceDir = getWorkspaceDir()
242
242
  const skill = msg.content.skills_scope[0]
243
243
  const skillDir = `${workspaceDir}/skills/${skill.skill_code}`
244
- const skillText = `在目录"${skillDir}"下读取并使用技能"${skill.skill_code}",`
244
+ const skillText = `用户选择使用此技能:"${skill.skill_code}",技能路径是:"${skillDir}",在目录下查找并`
245
245
  text = skill.skill_code ? `${skillText} ${text}` : text
246
246
  dcgLogger(`skill: text: ${text}`)
247
247
  }
@@ -37,7 +37,7 @@ function isSafePath(filepath: string, workspaceDir?: string): boolean {
37
37
  if (ws && isPathInsideDir(filepath, ws)) return true
38
38
  const p = toPosixPath(filepath)
39
39
  if (p.startsWith('/workspace/') || p === '/workspace') return true
40
- if (p === '/mobook') return true
40
+ if (p.startsWith('/mobook/') || p === '/mobook') return true
41
41
  return /^[A-Za-z]:\/(workspace|mobook)(\/|$)/.test(p)
42
42
  }
43
43
 
@@ -183,6 +183,15 @@ export function createDcgchatMessageTool(pluginCtx: DcgchatMessageToolContext):
183
183
  sentKeys.add(key)
184
184
  }
185
185
 
186
+ if (args.media?.length && sentFiles.size === 0) {
187
+ return jsonResult({
188
+ success: false,
189
+ error:
190
+ '未能发送任何附件:路径须位于当前 Agent 工作区,或为 /workspace/、/mobook/ 下的真实文件(非空、扩展名在白名单内)。',
191
+ sentMediaCount: 0
192
+ })
193
+ }
194
+
186
195
  let content = args.content ?? ''
187
196
  for (const filepath of sentFiles) {
188
197
  const posix = toPosixPath(filepath)