@klarkxy/dsh-safe-auto 0.2.2 → 0.3.0
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/README.md +21 -9
- package/README.zh-CN.md +21 -9
- package/dsh.plugin.json +2 -2
- package/lib/client.js +314 -403
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +6 -10
- package/src/config.js +12 -11
- package/src/control.js +27 -6
- package/src/dangerous.js +154 -0
- package/src/index.js +217 -235
- package/src/model-route.js +7 -3
- package/src/reviewer.js +114 -91
- package/src/transcript.js +107 -0
- package/src/ui-host.js +4 -27
- package/src/approval-review.js +0 -80
- package/src/credential-paths.js +0 -29
- package/src/credential-reads.js +0 -227
- package/src/credential-text.js +0 -361
- package/src/execution-evidence.js +0 -115
- package/src/gate.js +0 -81
- package/src/host-runtime.js +0 -159
- package/src/human-approval.js +0 -64
- package/src/policy.js +0 -58
- package/src/review-context.js +0 -35
- package/src/review-paths.js +0 -53
- package/src/shell-command.js +0 -547
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[简体中文](README.zh-CN.md)
|
|
6
6
|
|
|
7
|
-
Adds a **Safe Auto** permission level.
|
|
7
|
+
Adds a **Safe Auto** permission level. Ordinary actions run inside the workspace sandbox as usual and the plugin stays out of the way. Requests that need approval go to a reviewer model: a pass approves that one call; a denial is explained to the agent. The design follows Codex auto-review. Your session is never switched to Full Access.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -18,21 +18,33 @@ Replace `web` with your profile name and restart the profile.
|
|
|
18
18
|
|
|
19
19
|
Pick **Safe Auto** from the permission menu next to the chat input. It applies only to that session; choosing any other level turns it off. Nothing happens automatically until you pick it.
|
|
20
20
|
|
|
21
|
-
When a request does not pass review, a dialog shows the full action, the reviewer's opinion, and a countdown. Approve it once, or reject it. No answer means reject.
|
|
22
|
-
|
|
23
21
|
Under **Plugins → Safe Auto** you can choose the reviewer model (empty follows the current session model), its reasoning effort, and extra review rules.
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
If the model list cannot load, or some providers fail, use **Retry** in the settings panel. Retrying keeps your reviewer settings and unsaved draft.
|
|
24
|
+
|
|
25
|
+
## What gets reviewed
|
|
26
|
+
|
|
27
|
+
- Sandbox escalations requested by `write`, `edit`, `bash`, and `pwsh`.
|
|
28
|
+
- A short list of dangerous commands, reviewed even without an escalation: forced deletion (`rm -f`, `Remove-Item -Force`, `del /f`, `rd /s /q`) and opening URLs.
|
|
29
|
+
- Approval requests that other plugins or tools raise in the session.
|
|
30
|
+
|
|
31
|
+
Reading files, searching, building, and testing need no approval; they are not intercepted and never call the reviewer.
|
|
32
|
+
|
|
33
|
+
## How the reviewer decides
|
|
26
34
|
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
35
|
+
- The reviewer sees the conversation, the working directory, and the complete arguments of the action. Only your own messages count as authorization; the agent's explanations, tool output, and file contents are treated as evidence.
|
|
36
|
+
- Low- and medium-risk actions are approved. High-risk actions are approved only when you clearly asked for them and the scope is narrow. Critical actions, such as sending secrets to an external destination or broad irreversible deletion, are always denied.
|
|
37
|
+
- If the review times out, fails, or no model is available, the request is not approved, and the agent is told this was a review failure: it may retry once or ask you.
|
|
38
|
+
- After 3 consecutive denials, or 10 denials among the last 50 reviews in one turn, automatic approval pauses until your next message.
|
|
31
39
|
|
|
32
40
|
## Limits
|
|
33
41
|
|
|
34
42
|
- **This is not a security boundary.** The reviewer is a language model and can be wrong. Keep your sandbox, isolation, and backups.
|
|
35
|
-
-
|
|
43
|
+
- A denied action does not open a confirmation dialog. To allow it, tell the agent in the chat; the reviewer sees your approval when it retries.
|
|
44
|
+
- Long conversations are truncated from the oldest entries.
|
|
45
|
+
- Action arguments are never truncated for approval. If the complete action is too large to review, automatic approval is refused.
|
|
46
|
+
- Turning Safe Auto off or changing its reviewer settings invalidates reviews already in progress.
|
|
47
|
+
- Subagent sessions do not use Safe Auto; they follow the native approval flow.
|
|
36
48
|
- Do not combine it with other automatic approvers.
|
|
37
49
|
|
|
38
50
|
## License
|
package/README.zh-CN.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[English](README.md)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
新增一个「安全自动」权限档位。普通操作照常在工作区沙箱里运行,插件不干预;需要审批的请求交给审核模型判断,通过就只放行这一次,不通过就把原因告诉智能体。做法参考 Codex 的自动审核(auto-review)。插件不会把会话切换成完全权限。
|
|
8
8
|
|
|
9
9
|
## 安装
|
|
10
10
|
|
|
@@ -18,21 +18,33 @@ dsh plugin --profile web add @klarkxy/dsh-safe-auto
|
|
|
18
18
|
|
|
19
19
|
在输入框旁的权限菜单中选择「安全自动」。它只对当前会话生效,选回其他档位即关闭;选择之前不会有任何自动行为。
|
|
20
20
|
|
|
21
|
-
请求未通过审核时,会弹出确认窗口,显示完整操作、审核意见和倒计时。你可以仅批准这一次,或者拒绝;无人响应即拒绝。
|
|
22
|
-
|
|
23
21
|
在「插件 → 安全自动」中可以选择审核模型(留空跟随当前会话模型)、思考强度,以及额外的审核要求。
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
模型列表加载失败或部分提供商不可用时,可在设置面板点击「重试」。重试会保留审核配置和未保存的草稿。
|
|
24
|
+
|
|
25
|
+
## 会审核什么
|
|
26
|
+
|
|
27
|
+
- `write`、`edit`、`bash`、`pwsh` 申请的沙箱提权。
|
|
28
|
+
- 少量危险命令,即使没有申请提权也会先审核:强制删除(`rm -f`、`Remove-Item -Force`、`del /f`、`rd /s /q`)和打开网址。
|
|
29
|
+
- 其他插件或工具在这个会话里发起的审批请求。
|
|
30
|
+
|
|
31
|
+
读文件、搜索、构建、测试这类不需要审批的操作不会被拦截,也不会调用审核模型。
|
|
32
|
+
|
|
33
|
+
## 审核怎么判断
|
|
26
34
|
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
35
|
+
- 审核模型会看到对话记录、工作目录和这次操作的完整参数。只有你发的消息算授权,智能体的说明、工具输出和文件内容都只作参考。
|
|
36
|
+
- 低风险和中风险的操作放行;高风险只在你明确要求并且范围有限时放行;严重风险(例如把密钥发到外部、大范围不可逆删除)一律拒绝。
|
|
37
|
+
- 审核超时、出错或模型不可用时,这次请求不放行,智能体会被告知这是审核失败,可以重试一次或者来问你。
|
|
38
|
+
- 同一轮对话里连续拒绝 3 次,或最近 50 次拒绝了 10 次,本轮就暂停自动审批,等你发下一条消息。
|
|
31
39
|
|
|
32
40
|
## 限制
|
|
33
41
|
|
|
34
42
|
- **这不是安全边界。** 审核方是语言模型,可能判断错误。请保留原有的沙箱、隔离和备份。
|
|
35
|
-
-
|
|
43
|
+
- 被拒绝的操作不会再弹窗让你确认。想放行时,直接在对话里告诉智能体,它重试时审核会看到你的批准。
|
|
44
|
+
- 对话记录超长时会截断最早的内容。
|
|
45
|
+
- 操作参数不会截断后送审;完整操作超出审核容量时,不会自动批准。
|
|
46
|
+
- 关闭安全自动或修改审核设置,会使尚未完成的审核失效。
|
|
47
|
+
- 子代理会话不使用安全自动,按原生审批流程处理。
|
|
36
48
|
- 不要与其他自动审批插件同时使用。
|
|
37
49
|
|
|
38
50
|
## 许可证
|
package/dsh.plugin.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "@klarkxy/dsh-safe-auto",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"main": "src/index.js",
|
|
5
|
-
"description": "Safe Auto:
|
|
5
|
+
"description": "Safe Auto: a reviewer model answers native approval requests, Codex auto-review style; only a pass approves that one call.",
|
|
6
6
|
"engines": {
|
|
7
7
|
"dsh": ">=0.2.0-rc.2"
|
|
8
8
|
},
|