Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions docs/en/guides/configuration/approval.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,17 @@ Automatic mode uses **Direct review** by default. Direct review judges the actio

Both strategies ask you to confirm file deletion, including temporary files and build outputs. With Individual risk checks, the dialog identifies the matching risk from the checklist below.

Individual risk checks send the visible conversation history to the configured approval judge, including user messages, assistant text, historical tool calls, and any available compaction summary. The pending call is sent separately. Tool results are omitted except for authenticated answers from the user question dialog. A summary can provide context but does not itself authorize an action or lift a user boundary. When a Responses session continues on the provider, the review also uses the visible history saved locally by iCode. An externally hosted ACP agent may expose only the current user turn and pending call. The pending call also includes its tool kind, the workspace roots and the current time. For an in-process sub-agent, the review includes the calling conversation at delegation and any current user instructions missing from the visible history. A queued follow-up can inform approval once it is included in a model request. If Send now supersedes a pass, any pending Formal approval from that pass expires. Delegation text and workflow node inputs are identified by their source. The workflow run request supplies the user's own instructions. The review places each queued follow-up where the model received it, after any tool calls that ran before delivery. Adjacent messages alone do not establish consent or lift a user boundary. Verified answers appear at submission time with their original questions. Verified question answers are paired with the question shown, and any hook-provided text is attributed separately. The judge retains the original answer even if a hook withholds the tool result from the agent.

To choose a strategy:

1. Enter `/approval auto` to switch to automatic mode.
2. Press **F10**, open **Safety → Approval**, and find **Automatic review strategy**.
3. Choose **Direct review** or **Individual risk checks**, then close Settings. Your choice is saved automatically and takes effect when the window closes. A review already in progress finishes as before.

Individual risk checks cover these actions:
Individual risk checks apply three hard rules for sensitive data transfer, file or folder deletion, and sensitive file access. They also check explicit user boundaries and other risks, including changes to shared infrastructure, security controls, and Git history. A hard rule, an active user boundary, or a soft rule without the required consent opens an approval dialog.

| Action | Examples |
| --- | --- |
| Sending or publishing content outside your computer | Pushing code, uploading files, or sending messages |
| Deleting or destroying data | Removing files or folders, emptying a file, or discarding changes that cannot be recovered |
| Changing shared or production systems | Deploying a service or changing a shared database |
| Accessing sensitive information | Reading API keys or account credentials |
| Changing security settings | Granting broader permissions or disabling security checks |
| Running untrusted code or exposing a service | Downloading and running a script, or making a local service accessible to others |
| Going beyond your request | Changing configuration when you only asked to inspect it |

When no risk is found, the action can run automatically. If something is unclear, iCode reviews the action again before deciding whether to run it or ask you. For workflows started without task input, actions with no detected risk also get this extra review. If review fails or times out, an approval dialog lets you decide what to do.
When all checks clear, the action can run automatically. If the review cannot return a valid decision after a retry, fails, or times out, an approval dialog lets you decide what to do.

This setting applies only in automatic mode. Actions that do not need approval and [approvals you have already remembered](#remember-approvals) continue to work as before.

Expand Down
16 changes: 4 additions & 12 deletions docs/zh-Hans/guides/configuration/approval.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,17 @@

两种方式都会要求你确认文件删除操作,包括临时文件和构建输出。“逐项风险检查”的审批弹窗还会指出命中了下方清单中的哪项风险。

“逐项风险检查”将可见的会话历史发送给配置的审批裁判模型,包括用户消息、助手文字、历史工具调用和已有的压缩摘要。待审调用单独提供,输入省略普通工具结果,保留由 iCode 确认来源的用户问答结果。压缩摘要可补充背景,用户授权及边界解除仍须有用户消息作为依据。当 Responses 会话通过服务端续接时,逐项风险检查也会使用 iCode 本地保存的可见历史。外部托管的 ACP 智能体可能只提供本轮用户消息和待审调用。 待审调用还附有工具类型、工作区根目录和当前时间。审查内置子智能体时,裁判会看到委派时的调用方会话及可见历史尚未收录的本轮用户指令,并区分委派文本的来源。排队的补充消息进入模型请求后,才能作为审批依据。点击“立刻发送”并成功中止当前执行时,该次执行中仍待定的逐项风险检查会失效。工作流节点的输入也会标明来源,工作流运行请求提供用户本人的指令。审查按模型的接收顺序呈现排队的补充消息,先前执行的工具调用会保留在消息之前。消息位置相邻,本身不足以认定授权或解除用户边界。经过验证的回答按提交时间呈现,并与原问题成对保留。经过验证的回答与实际展示的问题成对提供,钩子提供的文本单独标明来源。钩子对智能体隐藏工具结果时,裁判仍会收到用户的原始回答。

修改方式如下:

1. 输入 `/approval auto`,切换到自动模式。
2. 按 **F10**,打开“安全管控 → 审批”,找到“自动审查策略”。
3. 选择“直接审查”或“逐项风险检查”,然后关闭设置窗口。选项会自动保存,关闭窗口后生效;正在进行的审查仍按原来的方式完成。

“逐项风险检查”会检查以下操作:
“逐项风险检查”对敏感数据外传、文件或文件夹删除、敏感文件访问应用三条硬规则。它还检查用户明确设定的边界,以及修改共享基础设施、安全控制或 Git 历史等风险。命中硬规则、仍生效的用户边界,或缺少相应授权的软规则时,会弹出审批窗口。

| 操作 | 例子 |
| --- | --- |
| 向电脑以外发送或发布内容 | 推送代码、上传文件、发送消息 |
| 删除或破坏数据 | 删除文件或文件夹、清空文件、丢弃无法恢复的改动 |
| 修改共享或线上系统 | 部署服务、修改共享数据库 |
| 访问敏感信息 | 读取 API 密钥、账户凭据 |
| 更改安全设置 | 放宽权限、关闭安全检查 |
| 运行不可信代码或对外开放服务 | 下载并运行脚本、让其他人可以访问本地服务 |
| 超出你的要求 | 你只要求查看配置,却准备修改配置 |

没有发现风险时,操作可以自动执行。遇到无法判断的情况,iCode 会再审查一次,然后决定执行还是请你确认。如果工作流启动时没有填写任务输入,即使未发现风险,也会再审查一次。如果审查失败或超时,会弹出审批窗口,由你决定如何处理。
所有检查通过后,操作可以自动执行。如果重试后仍无法获得有效判定,或审查失败、超时,会弹出审批窗口,由你决定如何处理。

这个设置只在自动模式下生效。无需审批的操作和[你已选择记住的审批](#记住审批)仍按原有规则执行。

Expand Down
60 changes: 51 additions & 9 deletions locales/chrys.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4655,22 +4655,52 @@ msgstr ""
msgid "tui.approval.review.triggered"
msgstr ""

#. English: Deletion or destructive changes
#. chrys-meta={"fingerprint":"40f27eb4b731fad44e4f8169ef139d0b4a463609416faab1a72bf6211f886333","multiline":false,"placeholders":[]}
#. English: Tampering with agent state
#. chrys-meta={"fingerprint":"dfe9947a6a7d753b90a2da378398fefb196a50cacc78898f0c434ea12158bfa6","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.destructive_action"
msgid "tui.approval.risk.agent_state_tamper"
msgstr ""

#. English: External publication or transfer
#. chrys-meta={"fingerprint":"fca65260a1707caa0f9aace61e4db8031c2f5210c48f15ce98cb48a79f042951","multiline":false,"placeholders":[]}
#. English: Credential leakage
#. chrys-meta={"fingerprint":"280e3ff6577147d71f42e0317ca5443e7ac87c010dfc66e0f41b350f19685fee","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.external_action"
msgid "tui.approval.risk.credential_leakage"
msgstr ""

#. English: Actions beyond the requested scope
#. chrys-meta={"fingerprint":"ae29394698d983d8bd226f5f0f7b9c6e93df24c38c5c48313502fac0fcf49d1e","multiline":false,"placeholders":[]}
#. English: Sensitive data transfer outside its trust boundary
#. chrys-meta={"fingerprint":"8b779853bef0570ca7a0070e6fa0180dd8584d13dec6c5ec1c5de0d57f10909e","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.scope_escalation"
msgid "tui.approval.risk.data_exfiltration"
msgstr ""

#. English: Preparation for sensitive data exfiltration
#. chrys-meta={"fingerprint":"a00c4aad388840d1606ac05ef0e7a7840113c455edd5c347449b21292366419c","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.exfil_scouting"
msgstr ""

#. English: File or folder deletion
#. chrys-meta={"fingerprint":"037ca167d4b570176389e43fe7982b8290252b108f6b2c85e794207844a910ce","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.file_folder_deletion"
msgstr ""

#. English: Destructive Git operations
#. chrys-meta={"fingerprint":"f1aaf675fd28560aca93b14710ba08980385818852c953c8461e116197313199","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.git_destructive"
msgstr ""

#. English: A change that would leak data when run
#. chrys-meta={"fingerprint":"23dd19bee18d1a6a1053cf673f4a03c9576a55e4dacbd08228e8e79b0bda92d4","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.leak_path"
msgstr ""

#. English: Changing a remote destination
#. chrys-meta={"fingerprint":"3349390778032aa3c52e8be3ef7969503da7ba2f50521a3b57f0e3624565d9e4","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.remote_repoint"
msgstr ""

#. English: Security or permission changes
Expand All @@ -4697,6 +4727,18 @@ msgstr ""
msgid "tui.approval.risk.untrusted_execution"
msgstr ""

#. English: Deletion with unverified targets
#. chrys-meta={"fingerprint":"ff5865146525f0690f5c376eb745084a1649c3cbffc5ca64824c67f330158c9d","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.unverified_delete"
msgstr ""

#. English: An active user boundary
#. chrys-meta={"fingerprint":"6a4d99781b22d261d5ba19666a3f203a5db4a6ecf3871158b7dad875cf3c1750","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.user_boundary"
msgstr ""

#. English: Review sub-agent delegation
#. chrys-meta={"fingerprint":"7dcb85149a86ce191f347580fab4a3af3588038f343870f21f4ac65eed0af3c8","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/bodies/sub_agent.py
Expand Down
75 changes: 63 additions & 12 deletions locales/zh-Hans/LC_MESSAGES/chrys.po
Original file line number Diff line number Diff line change
Expand Up @@ -4691,23 +4691,53 @@ msgstr "自动审查超时。"
msgid "tui.approval.review.triggered"
msgstr "需要人工确认:{conditions}。"

#. English: Deletion or destructive changes
#. chrys-meta={"fingerprint":"40f27eb4b731fad44e4f8169ef139d0b4a463609416faab1a72bf6211f886333","multiline":false,"placeholders":[]}
#. English: Tampering with agent state
#. chrys-meta={"fingerprint":"dfe9947a6a7d753b90a2da378398fefb196a50cacc78898f0c434ea12158bfa6","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.destructive_action"
msgstr "删除或破坏性修改"
msgid "tui.approval.risk.agent_state_tamper"
msgstr "篡改智能体状态"

#. English: External publication or transfer
#. chrys-meta={"fingerprint":"fca65260a1707caa0f9aace61e4db8031c2f5210c48f15ce98cb48a79f042951","multiline":false,"placeholders":[]}
#. English: Credential leakage
#. chrys-meta={"fingerprint":"280e3ff6577147d71f42e0317ca5443e7ac87c010dfc66e0f41b350f19685fee","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.external_action"
msgstr "对外发布或传输"
msgid "tui.approval.risk.credential_leakage"
msgstr "凭据泄露"

#. English: Actions beyond the requested scope
#. chrys-meta={"fingerprint":"ae29394698d983d8bd226f5f0f7b9c6e93df24c38c5c48313502fac0fcf49d1e","multiline":false,"placeholders":[]}
#. English: Sensitive data transfer outside its trust boundary
#. chrys-meta={"fingerprint":"8b779853bef0570ca7a0070e6fa0180dd8584d13dec6c5ec1c5de0d57f10909e","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.scope_escalation"
msgstr "超出用户要求的操作"
msgid "tui.approval.risk.data_exfiltration"
msgstr "敏感数据跨信任边界传输"

#. English: Preparation for sensitive data exfiltration
#. chrys-meta={"fingerprint":"a00c4aad388840d1606ac05ef0e7a7840113c455edd5c347449b21292366419c","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.exfil_scouting"
msgstr "为敏感数据外发做准备"

#. English: File or folder deletion
#. chrys-meta={"fingerprint":"037ca167d4b570176389e43fe7982b8290252b108f6b2c85e794207844a910ce","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.file_folder_deletion"
msgstr "删除文件或文件夹"

#. English: Destructive Git operations
#. chrys-meta={"fingerprint":"f1aaf675fd28560aca93b14710ba08980385818852c953c8461e116197313199","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.git_destructive"
msgstr "破坏性 Git 操作"

#. English: A change that would leak data when run
#. chrys-meta={"fingerprint":"23dd19bee18d1a6a1053cf673f4a03c9576a55e4dacbd08228e8e79b0bda92d4","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.leak_path"
msgstr "执行后会泄露数据的变更"

#. English: Changing a remote destination
#. chrys-meta={"fingerprint":"3349390778032aa3c52e8be3ef7969503da7ba2f50521a3b57f0e3624565d9e4","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.remote_repoint"
msgstr "更改远端目标"

#. English: Security or permission changes
#. chrys-meta={"fingerprint":"0ccb3ecc7cc9a9b333514af148bfd35266dec1888da772877e9410187cff8377","multiline":false,"placeholders":[]}
Expand All @@ -4733,6 +4763,18 @@ msgstr "共享或生产资源修改"
msgid "tui.approval.risk.untrusted_execution"
msgstr "不可信代码或对外开放服务"

#. English: Deletion with unverified targets
#. chrys-meta={"fingerprint":"ff5865146525f0690f5c376eb745084a1649c3cbffc5ca64824c67f330158c9d","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.unverified_delete"
msgstr "删除目标未经核实"

#. English: An active user boundary
#. chrys-meta={"fingerprint":"6a4d99781b22d261d5ba19666a3f203a5db4a6ecf3871158b7dad875cf3c1750","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/review_reason.py
msgid "tui.approval.risk.user_boundary"
msgstr "用户设定且仍有效的边界"

#. English: Review sub-agent delegation
#. chrys-meta={"fingerprint":"7dcb85149a86ce191f347580fab4a3af3588038f343870f21f4ac65eed0af3c8","multiline":false,"placeholders":[]}
#: src/chrys/app/tui/screens/dialogs/approval/bodies/sub_agent.py
Expand Down Expand Up @@ -18335,6 +18377,15 @@ msgstr "工作区列表无法保存:{reason}"
#~ msgid "tui.approval.review.cancelled"
#~ msgstr "自动审查已取消。"

#~ msgid "tui.approval.risk.destructive_action"
#~ msgstr "删除或破坏性修改"

#~ msgid "tui.approval.risk.external_action"
#~ msgstr "对外发布或传输"

#~ msgid "tui.approval.risk.scope_escalation"
#~ msgstr "超出用户要求的操作"

#~ msgid "tui.approval_mode.description.auto_formal"
#~ msgstr "逐项检查风险,按固定规则审批;判断不明确时由模型复核。"

Expand Down
4 changes: 3 additions & 1 deletion src/chrys/app/acp/doc/frontend-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@ All routed through `ext_method`.
| `session/retry` | `sessionId`, `text?` | Retry the session's last failed or interrupted turn. Resumes the **same** turn (the response `_meta.chrys.turnId` is the one the original prompt reported, and `chrys/turn_started` carries `isRetry: true`; `chrys/messages_retracted` then withdraws the cut-off answer the retry drops — see *Streamed text*), opens no new user message, so the response carries no `userMessageId`. `text` is optional guidance persisted as user input inside the resumed turn, not metadata: it goes through the same approval gate and `user_prompt_submit` hooks as a prompt and can be rejected. Refused with `invalid_params` when the session has no retryable turn, and when a turn is running — cancel it first (`session/cancel`), the retry is never queued behind a live turn. |
| `session/set_config_option` | `sessionId`, `key`, `value` | Persist a supported config key to the user settings document + awaited reload, then push `chrys/runtime_update` (global default; see below). `key` accepts the logical name or its legacy `CHRYS_*` spelling; the response carries all three names (`key` echoed, `envKey`, `settingKey`). The session must be active — it is validated *before* the document write, so a failed request never leaves persisted config mutated. |

`session/set_config_option` accepts `key="approval_auto_review"` with `value="direct"` or `value="formal"`. It writes the user setting `approval.auto_review` (environment alias `CHRYS_APPROVAL_AUTO_REVIEW`), reloads settings, and applies only when the session uses `auto`. The default is `direct`. Individual risk checks use the configured approval model for both checks and any uncertain-action review. This is a global user setting, not a session-local mode; in-flight reviews keep their bound strategy.
`session/set_config_option` accepts `key="approval_auto_review"` with `value="direct"` or `value="formal"`. It writes the user setting `approval.auto_review` (environment alias `CHRYS_APPROVAL_AUTO_REVIEW`), reloads settings, and applies only when the session uses `auto`. The default is `direct`. The setting applies globally, and in-flight reviews keep the strategy selected when they started.

Formal uses the configured approval model for individual risk checks. If the checks require confirmation, the model still returns an invalid response after format retries, or the review fails or times out, the ACP client asks the user to decide. Formal does not fall back to Direct review.

For external ACP agents used as sub-agents or workflow nodes, individual risk
checks append local audit entries to `acp_state.translated_updates`. Each entry
Expand Down
Loading
Loading