refactor: enhance MCP tool management with risk policies and confirmation handling

This commit is contained in:
mlogclub
2026-07-28 11:33:15 +08:00
parent ed109047d3
commit 07370fe9a2
17 changed files with 448 additions and 117 deletions
+14 -2
View File
@@ -46,12 +46,24 @@ func resolveInterruptPrompt(summary *applicationruntime.RunResult) string {
if summary == nil || len(summary.Interrupts) == 0 {
return i18nx.Get("conversation.interrupt.defaultPrompt")
}
if prompt := extractInterruptMessage(summary.Interrupts[0].InfoPreview); prompt != "" {
interrupt := summary.Interrupts[0]
if prompt := strings.TrimSpace(interrupt.PromptText); prompt != "" {
return prompt
}
if prompt := strings.TrimSpace(summary.Interrupts[0].InfoPreview); prompt != "" {
if prompt := extractInterruptMessage(interrupt.InfoPreview); prompt != "" {
return prompt
}
if prompt := strings.TrimSpace(summary.ReplyText); prompt != "" {
return prompt
}
if interrupt.Type != "tool_confirmation" {
if prompt := strings.TrimSpace(interrupt.InfoPreview); prompt != "" {
return prompt
}
}
if displayName := strings.TrimSpace(interrupt.DisplayName); displayName != "" {
return "即将执行“" + displayName + "”,是否确认继续?"
}
return i18nx.Get("conversation.interrupt.defaultPrompt")
}