feat: v0.7.0 四阶段全量迭代 — 修复面收口 · 安全纵深 · 架构还债 · 能力演进
P1 修复面收口: v0.6.3 截断自愈推全量(Anthropic/Ollama/非流式/引擎兜底); SSE 上游错误帧检测进重试通道; clearMessages 摘要游标根治; truncateResult 内联图片白名单统一; 前端四 bug(确认弹窗锁死/MemoryViewer/ Virtuoso Footer/abort 尾部过滤) + reasoning 缓冲跨迭代污染; 托盘通知过滤与新建会话死链接线 P2 安全纵深: MCP 审批闭环(ConfirmationHook×PolicyEngine 联动+重名拒注册); SSRF 收敛 ssrf-guard 共享模块 (web_fetch 双通道校验+重定向终态复检); Electron 加固(preload CJS 化→sandbox:true/CSP/权限白名单/will-navigate); run_command cmd.exe 白名单通道元字符守门; diff_viewer 10MB 预检; Anthropic thinking 预算下限; Agnes 思考显式关闭 P3 架构还债: OpenAICompatibleAdapter 中间基类收敛四家样板; 错误分类单轨化(删 mapError/getFetchSignal, 超时显式 ETIMEDOUT); PRAGMA user_version 迁移版本化; 死代码清理专项(cn.ts/SHORTCUTS/ContextMenu 分支/ getWindowState/modifiedArgs/sandbox 空壳); i18next 引入; a11y 第一轮; SearXNG 页批量草稿模型统一 P4 能力演进: Ollama pull 可取消/capabilities 探测/num_ctx 实测缓存; UpdateService feed 比对式自动更新 (app:updateCheck IPC + StatusBar 入口); MiMo providerOptions(web_search 服务端工具/strict JSON); web_fetch extract_mode=markdown(turndown); network.proxyUrl 全局代理(Chromium sessions+undici dispatcher) 测试: 264 → 507 用例(Electron ABI 全绿零跳过), 覆盖引擎压缩管线/重试竞速/MEMORY.md 闸门/file_editor 五操作/ filesystem 七工具实体夹具/git 真实仓库/SSE 错误帧/全线截断自愈/Provider 请求形态矩阵/SSRF 表测/钩子分级矩阵/ OutputValidator 全量/SLO 指标/MCP 安全纯函数/task_manager 链路/渲染层纯域/i18n 桥契约
This commit is contained in:
@@ -226,6 +226,33 @@ export function ConfirmationDialog(): React.JSX.Element | null {
|
||||
return () => clearInterval(interval);
|
||||
}, [requests, refreshPending]);
|
||||
|
||||
// ===== v0.6.4 根治"超时锁死"===== 原缺陷:倒计时归零后若 refreshPending 拉回的
|
||||
// 条目仍处于过期态(后端超时 timer 尚未触发),isExpired 使全部按钮 disabled 且
|
||||
// ESC/backdrop 关闭被禁止 —— 弹窗进入完全锁死的静止态。
|
||||
// 双保险修复:
|
||||
// ① 兜底自动拒绝 —— 过期 2.5 秒后若过期条目仍在(F-6 刷新没能消解它们),
|
||||
// 前端按后端一致的"超时=拒绝"语义补发批量响应并移除,弹窗必然收敛;
|
||||
// ② 恢复用户能动性 —— 见下方按钮区:拒绝全部始终可用、ESC/backdrop 可执行
|
||||
// 拒绝全部(对已失效 id 的响应由后端安全跳过,不再有状态不一致风险)。
|
||||
useEffect(() => {
|
||||
if (requests.length === 0 || remainingMs > 0) return;
|
||||
const expiredIds = requests
|
||||
.filter((r) => typeof r.expiresAt === 'number' && r.expiresAt <= Date.now())
|
||||
.map((r) => r.toolCallId);
|
||||
if (expiredIds.length === 0) return;
|
||||
const timer = setTimeout(() => {
|
||||
window.metona?.tool?.sendConfirmationResponseBatch({
|
||||
toolCallIds: expiredIds,
|
||||
approved: false,
|
||||
remember: false,
|
||||
});
|
||||
const idSet = new Set(expiredIds);
|
||||
setRequests((prev) => prev.filter((r) => !idSet.has(r.toolCallId)));
|
||||
setSelectedIds(new Set());
|
||||
}, 2500);
|
||||
return () => clearTimeout(timer);
|
||||
}, [requests, remainingMs]);
|
||||
|
||||
// 按工具名分组(同工具多次调用折叠为一组)
|
||||
const grouped: GroupedRequests[] = useMemo(() => {
|
||||
const map = new Map<string, GroupedRequests>();
|
||||
@@ -371,9 +398,9 @@ export function ConfirmationDialog(): React.JSX.Element | null {
|
||||
<Dialog
|
||||
open={requests.length > 0}
|
||||
onClose={(_, reason) => {
|
||||
// 超时时禁止通过外部点击/ESC 关闭(与"拒绝全部"按钮 disabled 一致)
|
||||
// 防止超时后用户误触关闭,导致后端 pending 状态不一致
|
||||
if (isExpired) return;
|
||||
// v0.6.4: 移除"超时后禁止关闭"拦截 —— 它配合全按钮 disabled 会把弹窗
|
||||
// 锁死在静止态(见上方自动拒绝兜底注释)。对已失效 id 的批量响应由
|
||||
// 后端 resolveConfirmationsBatch 安全跳过,拒绝语义幂等无副作用。
|
||||
// 审查修复: 内层二次确认 Dialog 打开时,外层禁用 ESC/backdrop 关闭
|
||||
// 防止 ESC 穿透到外层导致意外拒绝所有工具执行
|
||||
if (confirmAutoExecute) return;
|
||||
@@ -660,12 +687,13 @@ export function ConfirmationDialog(): React.JSX.Element | null {
|
||||
</DialogContent>
|
||||
|
||||
<DialogActions sx={{ px: 3, pb: 2 }}>
|
||||
{/* v0.6.4: 拒绝全部不再因过期被 disabled —— 过期场景下这是唯一有效的清理动作 */}
|
||||
<Button
|
||||
onClick={() => handleRespond(false, false)}
|
||||
color="error"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
disabled={isExpired}
|
||||
title={isExpired ? '已超时,点击立即清理全部请求' : '拒绝全部请求'}
|
||||
>
|
||||
拒绝全部 ({totalCount})
|
||||
</Button>
|
||||
@@ -675,7 +703,7 @@ export function ConfirmationDialog(): React.JSX.Element | null {
|
||||
variant="outlined"
|
||||
size="small"
|
||||
disabled={isExpired || allSelected}
|
||||
title={allSelected ? '已全部选中,请使用"批准选中"' : '批准全部请求'}
|
||||
title={isExpired ? '已超时(批准不再生效)' : allSelected ? '已全部选中,请使用"批准选中"' : '批准全部请求'}
|
||||
>
|
||||
批准全部
|
||||
</Button>
|
||||
@@ -686,6 +714,7 @@ export function ConfirmationDialog(): React.JSX.Element | null {
|
||||
size="small"
|
||||
autoFocus
|
||||
disabled={isExpired || selectedCount === 0}
|
||||
title={isExpired ? '已超时,将自动拒绝;如需重新触发请等待 Agent 重试' : undefined}
|
||||
>
|
||||
{isExpired
|
||||
? '已超时'
|
||||
|
||||
Reference in New Issue
Block a user