agentscope-ai / agentscope-ai/QwenPaw

[Feature] Simplify approval commands: short aliases + session/always scopes

未關閉
#4,450 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
34.9k
分支
3.1k
平均合併
1 天 15 小時
30 天內合併 PR
225

描述

## Simplify approval commands: short aliases + session/always scopes

> **中文摘要:** `/approve` 和 `/deny` 短命令已在 v1.1.7 中实现,但帮助文本和审批提示中未提及,用户不知道。本 issue 补充 `/session`、`/always`、`/reset` 命令,增加作用域支持(once/session/always),并更新提示文本。

### Background

Short commands `/approve` and `/deny` were already implemented in v1.1.7 (commit `9658e38b`). However:

1. The help text and approval prompts still show only `/approval approve`/`/approval deny`
2. No `session` or `always` scopes exist for persistent trust
3. No way to clear trust rules

### Proposed Changes

#### 1. Update prompts to mention short commands

All user-facing text should mention `/approve` and `/deny`:

| File | Current | Should be |
|---|---|---|
| `approval_handler.py:_usage_hint()` | `/approval approve` | `/approve` (mention both) |
| `approval_handler.py:_handle_list()` | `/approval approve ` | `/approve ` / `/deny ` |

#### 2. New commands

| Command | Function |
|---|---|
| `/session` | Trust this tool type for the current session |
| `/always` | Permanently whitelist this tool |
| `/reset` | Clear all session/always trust rules |

#### 3. Scope parameter on existing commands

```
/approve # approve once (current)
/approve session # approve for this session (new)
/approve always # permanently approve (new)
```

Or as standalone commands:
```
/session # approve current pending for session
/always # approve current pending permanently
```

#### 4. Session/always persistence

- `always` rules: stored in `config.json` → `security.approved_tools`
- `session` rules: in-memory, keyed by `root_session_id`, cleared on session end

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。