Repository navigation
feat(backend): 桌面端 Bash 运行中推送输出快照,并合并节流 tool.status - #77
Merged
Merged
Conversation
LiveAgent #975:编译等长命令运行期间看不到任何输出。
- agent:运行中输出回调原先只接 CLI 的 bash,桌面端 LiveAgent 目录里的 Bash
也走 bashrun,现在一并推送尾部快照
- backend:OnToolOutput 不再每 100ms 直接发 16 KiB 快照,改经 toolOutputThrottle
合并:同一调用最多每 500ms 发一次、每次最多 4 KiB(尽量从整行开始、落在
UTF-8 边界),输出停住后补发最后一份;tool.result 发布前丢弃未发快照,
运行结束时停掉所有尾随发布,快照不会晚于结果出现
- 协议不变:仍是 tool.status{tool_call_id,status:"running",message},message 为
尾部快照(整体替换),旧客户端可忽略;会话历史仍只保存最终 tool.result
- docs/liveagent-backend.md 补充该事件的语义与上限
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.
配套 Stack-Cairn/LiveAgent#975(运行命令时显示实时输出)。
tool.status{tool_call_id,status:"running",message}(message 为输出尾部快照),此前只对 CLI 的bash生效;桌面端 LiveAgent 目录里的Bash走同一个 bashrun 却没有接上。现在两者都推送。internal/backend/tool_output.go节流:同一调用最多每 500ms 一次、每次最多 4 KiB(尽量整行、不截断 UTF-8),输出停止后仍发尾随快照;tool.result之后不再发送,运行结束取消所有挂起发布。事件日志最坏约 8 KB/s,会话历史仍只保存最终结果。docs/liveagent-backend.md已补充说明。测试:
go test ./internal/backend ./internal/agent ./internal/tools/... ./internal/protocol、go vet、新测试-race通过;包含桌面端Bash流式输出(无修复时失败)、节流/截断单测和端到端 HTTP 测试。