fix(mcp+adapter): 流式 tool_calls 解析修复 + MCP transport 超时保护

openai adapter transform_stream_chunk:
- OpenAI 流式分片是嵌套格式 function.{name,arguments},原样透传后
  json.Unmarshal 到扁平 ToolCall{name,arguments} 时 name 恒为空,
  accumulateStream flushToolCall 因 acc.name=="" 静默丢弃整个工具调用
  (流式路径自上线起 tool_calls 全部丢失的根因)
- 现在正确解包 function.name → name,function.arguments → raw_arguments
  (保留原始 JSON 字符串分片,由 accumulateStream 按 index 拼接)
- 不按 name 过滤分片:OpenAI 流式续传块 name 为空但携带 arguments 分片

mcp stdio/sse transport:
- stdio Send() 无超时:server 进程卡死时插件加载永久阻塞
- sse http.Client 无超时:远程 server 网络抖动/无响应时永久阻塞,
  导致 webui 等后续插件全部无法启动(生产实例偶发启动卡死根因)
- stdio 加 60s 请求超时;sse client 加 30s 整体 + 10s 拨号超时
This commit is contained in:
JianFeeeee
2026-08-25 18:58:19 +08:00
parent 23ae7d7cff
commit a4e0cfcaa1
4 changed files with 49 additions and 4 deletions

2
.gitignore vendored
View File

@ -36,7 +36,7 @@ third_party/homeagent-sdk/example/
codegraph.json
# 运行时产物(不提交)
adapters/
/adapters/
knowledge/
memory/
scripts/