VibeCoding ACP 发送的事件格式与 GUI 期望的格式不匹配。
{
"jsonrpc": "2.0",
"method": "session/update",
"params": {
"sessionId": "386a12b3",
"update": {
"sessionUpdate": "agent_thought_chunk",
"content": {
"type": "text",
"text": "Hello"
}
}
}
}| VibeCoding 事件类型 | GUI 事件类型 | 说明 |
|---|---|---|
agent_thought_chunk |
content |
思考过程 |
agent_message_chunk |
content |
消息内容 |
content |
content |
通用内容 |
tool_call |
toolCall |
工具调用开始 |
tool_call_update |
toolCallUpdate |
工具调用更新 |
status |
status |
状态更新 |
// 修复前
var update sessionUpdate
json.Unmarshal(params, &update)
// 修复后
var notification struct {
SessionID string `json:"sessionId"`
Update struct {
SessionUpdate string `json:"sessionUpdate"`
Content *contentBlock `json:"content,omitempty"`
// ...
} `json:"update"`
}
json.Unmarshal(params, ¬ification)switch update.SessionUpdate {
case "agent_thought_chunk", "agent_message_chunk":
// 转换为 content 事件
event.Type = "content"
event.Content = update.Content.Text
case "tool_call":
// 工具调用开始
case "tool_call_update":
// 工具调用更新
event.Type = "toolCallUpdate"
case "status":
// 状态更新
}switch (event.type) {
case 'content':
appendToStreamingMessage(event.content)
break
case 'toolCall':
// 显示工具调用
break
case 'toolCallUpdate':
if (event.data?.status === 'completed' && event.content) {
// 显示工具结果
}
break
}添加了调试日志:
[ACP EVENT] method=session/update
[ACP EVENT SEND] type=content content_len=50
# 重新构建
go build -o build/bin/vibecoding-gui .
# 运行应用程序
./build/bin/vibecoding-gui
# 查看 stderr 输出获取调试信息- 测试完整的消息流程
- 验证流式响应
- 测试工具调用显示