restart orphans tool use
This commit is contained in:
@@ -522,6 +522,12 @@ final class TranscriptBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
private func endTools() {
|
||||
for row in ctx.tools.values where row.result == nil && !(row.active || row.inActive) {
|
||||
row.unfinished = true
|
||||
}
|
||||
}
|
||||
|
||||
private func renderToolCall(_ p: JSONDict) -> Row {
|
||||
let row = Row(.tool(name: toolLabel(jsString(p["name"])), brief: toolBrief(p["input"] ?? nil, worktree()), input: prettyJSON(p["input"] ?? nil)), taskId: taskId)
|
||||
row.tag = subagentTag(parentOf(p))
|
||||
@@ -552,6 +558,9 @@ final class TranscriptBuilder {
|
||||
switch ev.kind {
|
||||
case "user.message":
|
||||
ctx.quiet = false
|
||||
if !bool(p, "mid_turn") {
|
||||
endTools()
|
||||
}
|
||||
let text = str(p, "text") ?? ""
|
||||
if ev.actor == "byre" {
|
||||
let first = text.components(separatedBy: "\n").first ?? ""
|
||||
@@ -591,9 +600,7 @@ final class TranscriptBuilder {
|
||||
return nil
|
||||
|
||||
case "turn.ended":
|
||||
for row in ctx.tools.values where row.result == nil && !(row.active || row.inActive) {
|
||||
row.unfinished = true
|
||||
}
|
||||
endTools()
|
||||
if bool(p, "handoff") {
|
||||
return note([.text("handoff written; continuing in a new session with a fresh context")])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user