Repository navigation
feat(agent): 工具报错卡片 — 错误码、建议操作、可否重试,折叠时可见 - #231
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
工具报错卡片
工具失败时后端返回
{ok:false, error:{code, message, retryable, suggestedAction}},以前界面要么只显示「出错」,要么露 JSON 原文。现在统一画成卡片。lib/agentToolError.ts:parseToolError(认直接对象 / JSON 字符串 /details/content[].text)、plainToolErrorText(旧格式ERROR: …的一句话兜底,不露 JSON)、isToolFailure(历史工具调用没有 status 时判失败)。AgentToolErrorCard:错误说明、错误码中文名 + 原码、可否重试、建议操作;AgentToolError认不出结构时退回一句话。EmbeddedAgentStreamView·ToolExecutionList:出错的工具在摘要下方直接露出卡片,折叠时也可见。AgentPanel·ToolCallRows:出错时卡片 / 一句话(并默认展开),成功时只留人话摘要;删除previewJson,不再显示原文。globals.css:.offeru-agent-panel .agent-tool-error*,只用--ou-*token;需要用户本人处理的(read_only/forbidden/unsupported)用--ou-tone-orange-*,其余中性。自检
agentToolError.test.ts(10)、AgentToolErrorCard.test.tsx(5)不改 workflows / 分支保护 / SQLite 表结构。