@dcrays/dcgchat 0.4.6 → 0.4.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",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "type": "module",
5
5
  "description": "OpenClaw channel plugin for 书灵墨宝 (WebSocket)",
6
6
  "main": "index.ts",
@@ -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)