agentscope-ai / agentscope-ai/QwenPaw

[Feature]: Configurable additional trusted workspace | 可配置的额外工作空间

Offen
#5,252 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
TypeScript
Sterne
35k
Forks
3.1k
Ø Merge
1 T. 13 Std.
Gemergte PRs (30 T.)
228

Beschreibung

> 以下内容由AI根据模板生成但经过人工审核
> The following content was generated by AI based on a template but has been manually reviewed.
> 文档中描述的具体方式与需求有些出入
> The specific implementation described in the document differs somewhat from the actual requirements.
> 简单来讲就是允许用户指定一些额外的目录作为无安全拦截的工作区,方便交付和多智能体联合调试
> In simple terms: allow users to designate additional directories as trusted workspaces without security interception, facilitating file delivery and multi-agent collaborative debugging.

## Summary

支持配置多个受信任的额外目录作为工作区,使 Agent 能直接读写这些目录下的文件而不触发安全拦截,方便文件交付和多智能体联合调试。

## Component(s) Affected

- [ ] Core / Backend (app, agents, config, providers, utils, local_models)
- [ ] Console (frontend web UI)
- [ ] Channels (DingTalk, Feishu, QQ, Discord, iMessage, etc.)
- [ ] Skills
- [ ] CLI
- [ ] Documentation (website)
- [ ] Tests
- [ ] CI/CD
- [ ] Scripts / Deploy

## Problem / Motivation

当前 CoPaw 的工作区固定在一个目录下(如 `C:\Users\admin\.copaw\workspaces\default`)。当 Agent 需要向用户交付文件(如生成的报告、压缩包、导出数据)时,存在两个问题:

1. **交付路径不直观**:用户需要进入深层隐藏目录才能找到文件,体验不佳。
2. **安全拦截**:当 Agent 通过 `execute_shell_command` 向系统目录(如 `E:\_paw`)写入文件后再删除时,**CoPaw 本身会拦截这些操作**,导致任务中断。

用户希望有一个**受信任的交付目录**,Agent 可以直接通过文件操作工具(如 `write_file`)读写该目录,而不触发安全拦截,同时用户也能在固定位置找到所有交付物。

## Proposed Solution

在配置中增加一个可选的 `delivery_directory`(或 `secondary_workspace`)字段:

```yaml
# config.yaml 示例
workspace:
primary: "C:\Users\admin\.copaw\workspaces\default"
delivery: "E:\_paw" # 用户指定的交付目录
```

功能要求:
- `write_file`、`read_file`、`edit_file` 等文件工具可以直接操作 `delivery` 目录下的文件,与操作主工作区无异。
- 该目录在 Agent 启动时即被标记为受信任,避免安全软件误报。
- 如果未配置,则保持现有行为(仅主工作区可用)。
- 支持相对路径和绝对路径。

## Alternatives Considered

1. **继续使用 shell 命令绕行**:通过 `execute_shell_command` 用 `echo`、`copy`、`del` 等系统命令操作外部目录。但这种方式:
- 触发安全软件拦截(实测 CoPaw 会拦截 `del` 操作)
- 需要处理不同系统的命令差异(Windows `del` vs Linux `rm`)
- 无法利用 Agent 的文件工具链(如 `edit_file` 的 diff 替换)

2. **用户手动将目录加入安全软件白名单**:可行但门槛高,且每个用户环境不同(Defender、360、火绒等),无法统一指导。

3. **通过符号链接(symlink)将交付目录映射到工作区**:Windows 下创建 symlink 需要管理员权限,且同样可能被安全软件拦截。

## Additional Context

- 实测环境:Windows 10,CoPaw Agent 通过 `execute_shell_command` 在 `E:\_paw` 创建和删除文件时,**被 CoPaw 自身安全机制拦截**。
- 当前 workaround:Agent 将交付文件写入主工作区,再通过 shell 命令复制到 `E:\_paw`,但删除操作仍被拦截。
- 类似功能参考:VS Code 的 `workspace` 支持多根目录(multi-root workspace),允许同时操作多个文件系统位置。

## Willing to Contribute

- [ ] I am willing to open a PR for this feature (after discussion).

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

The issue names no files or tests. Start by locating the workspace configuration, file-tool path checks, and agent startup initialization, then trace how the primary workspace becomes trusted. Done means multiple configured relative or absolute delivery directories are accepted by the file tools without changing behavior when none are configured, with coverage for the path and trust rules.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
backend, security
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.