agent-Specialization/docs/papers/翻译后_中文译文.txt
JOJO e2bbd767f7 feat(host-security+ui): unify host execution/approval behavior, runtime notices, and approval overlay UX
This commit consolidates a large set of host-mode security and UX fixes across backend and frontend.

Security / execution model:
- Make permission/execution mode switches apply immediately (no deferred pending-only behavior).
- Keep runtime mode change notices durable and visible via user-message guidance path.
- Add explicit runtime message source taxonomy support and persistence:
  user / presend / guidance / notify / sub_agent / background_command.
- Ensure guidance/notify insertion is batched per tool-cycle so mid-run inserts are committed together.
- Separate notify from guidance semantics for mode-change notices.
- Add direct-mode auto-fallback handling visibility on frontend.

Approval and command gating:
- Align run_command approval pre-check logic with docker behavior for approval/auto_approval modes in host execution paths.
- Keep approval retry flow and final-result semantics intact when permission errors trigger approval.
- Externalize forbidden command keyword list into JSON config:
  config/forbidden_commands.json.
- Update forbidden command rejection message to user-facing wording:
  用户不允许执行包含“... ”的指令.

Prompt/runtime guidance:
- Refine execution-mode runtime rule text to avoid endless workaround loops:
  one safe alternative first, then request switching to direct mode when truly required.

Chat rendering / message UX:
- Prevent injected guidance/notify user-messages from incorrectly triggering assistant work header/timer chain.
- Restore correct visibility after history reload while preserving runtime-source behavior.
- Update user-header icon/label rendering by message source:
  - guidance -> 引导 + navigation icon
  - notify/sub_agent/background_command -> 通知 + bell icon
  - user/presend -> keep normal user header.
- Add new icons: static/icons/navigation.svg, static/icons/bell.svg.

Approval panel UX:
- Convert desktop approval panel from layout-compress sidebar to overlay + blur sheet.
- Fix panel transition behavior (remove unintended vertical motion; use dedicated desktop overlay transition).
- Improve approval result display:
  - decision and reason split lines,
  - green/red status styling,
  - multiline reason rendering,
  - auto-collapse delay adjusted to 3s.

Execution mode TTL feedback:
- When direct mode auto-expires to sandbox, frontend menu state is updated from status snapshot.
- Show non-auto-dismiss warning toast to explicitly notify auto-fallback.

Misc consistency updates:
- Execution mode label text cleanup in composer.
- Runtime notice wording normalization (权限模式修改为..., 执行环境修改为...).

Build/test notes:
- Frontend rebuilt after UI changes.
- Smoke tests passed for server refactor path.
2026-05-12 19:16:38 +08:00

36 lines
4.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

【翻译后 - 中文译文】
ReAct协同推理与行动的语言模型
================================================================================
1 摘要
================================================================================
大型语言模型LLMs在语言理解和交互式决策等任务上展现出卓越的性能但其推理能力如思维链提示和行动能力如行动计划生成主要作为独立主题进行研究。本文探索利用大型语言模型以交错方式生成推理轨迹和任务特定行动使两者之间产生更大协同效应推理轨迹帮助模型诱导、跟踪和更新行动计划以及处理异常情况而行动则使其能够与外部来源如知识库或环境进行交互并收集额外信息。
================================================================================
2 引言
================================================================================
人类智能的一个独特特征是能够无缝地将面向任务的行动与语言推理(或内心独白)相结合,这种能力已被理论化为在人类认知中发挥重要作用,能够实现自我调节或策略制定,并维持工作记忆。以厨房烹饪菜肴为例,在任意两个步骤之间,可能会有多种选择:根据冰箱中的内容调整食谱,阅读菜谱描述以了解下一步该做什么,并确保菜肴有新鲜原料和适当调料。这种在推理与行动之间进行决策的能力对于人类完成复杂任务至关重要。
最近的研究表明在自主系统中结合语言推理与交互式决策是可能的。一方面经过适当提示的大型语言模型展现出解决复杂任务如数学问题和符号推理的推理能力。另一方面基于LLM的自主代理的最新研究已经实现了在交互式环境如网络和具身环境中的决策。本文提出了ReAct一种将推理和行动与语言模型相结合以解决各种语言推理和决策任务的通用范式。
================================================================================
3 方法
================================================================================
ReAct提示方法的核心思想是将推理和行动交错进行。在知识密集型任务如HotpotQA和Fever我们从训练集中随机选择少量示例并手动编写ReAct格式的轨迹作为少样本提示的示例。与思维链类似ReAct是一种协调推理和行动以解决任务的提示方法。关键区别在于ReAct轨迹包含显式的思考这些思考不仅计划和分解目标还结合对当前状态的推理、应用常识并跟踪进度。
格式如下思考1 -> 行动1 -> 观察1 -> ... -> 思考N -> 行动N。每个思考对当前情况和下一步要采取的行动进行推理而每个行动可以是以下类型之一1搜索实体从相应的维基百科实体页面返回前k个句子2查找字符串返回当前段落中包含该字符串的下一句模拟浏览器中的Ctrl+F命令。
================================================================================
4 相关工作
================================================================================
大型语言模型用于推理的工作中最著名的是思维链Chain-of-ThoughtCoT它揭示了LLMs通过少样本提示制定推理步骤的能力。后续工作包括自一致性用于在多个推理路径中进行多数投票以及思维树用于探索基于树搜索的推理模式。
在语言模型用于行动方面WebGPT使用LLMs通过搜索和浏览来导航网页。SayCan和PaLM-SayCan使用LLMs进行机器人行动计划。Inner Monologue在具身环境中使用"内心独白"但结合了预定义高级行动原语中的硬编码语言。相比之下ReAct以通用方式交错自由形式的语言推理和行动。
================================================================================
5 结论
================================================================================
本文提出了ReAct一种将推理和行动协同应用于大型语言模型的简单而有效的方法。通过一系列不同的任务我们证明了ReAct可以产生可解释的、高性能的任务解决轨迹优于纯行动和纯推理的基线方法。交错的推理轨迹允许模型动态地计划、跟踪和更新行动计划同时结合对外部环境的推理。
我们相信ReAct为构建更强大和可信的LLM代理提供了一个有前途的方向。未来的工作包括在更多样化的任务上探索ReAct研究使用交错推理和行动来提示和微调LLM的最佳方式以及将ReAct应用于文本之外的其他模态。