restart orphans tool use
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
@@ -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 {
|
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)
|
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))
|
row.tag = subagentTag(parentOf(p))
|
||||||
@@ -552,6 +558,9 @@ final class TranscriptBuilder {
|
|||||||
switch ev.kind {
|
switch ev.kind {
|
||||||
case "user.message":
|
case "user.message":
|
||||||
ctx.quiet = false
|
ctx.quiet = false
|
||||||
|
if !bool(p, "mid_turn") {
|
||||||
|
endTools()
|
||||||
|
}
|
||||||
let text = str(p, "text") ?? ""
|
let text = str(p, "text") ?? ""
|
||||||
if ev.actor == "byre" {
|
if ev.actor == "byre" {
|
||||||
let first = text.components(separatedBy: "\n").first ?? ""
|
let first = text.components(separatedBy: "\n").first ?? ""
|
||||||
@@ -591,9 +600,7 @@ final class TranscriptBuilder {
|
|||||||
return nil
|
return nil
|
||||||
|
|
||||||
case "turn.ended":
|
case "turn.ended":
|
||||||
for row in ctx.tools.values where row.result == nil && !(row.active || row.inActive) {
|
endTools()
|
||||||
row.unfinished = true
|
|
||||||
}
|
|
||||||
if bool(p, "handoff") {
|
if bool(p, "handoff") {
|
||||||
return note([.text("handoff written; continuing in a new session with a fresh context")])
|
return note([.text("handoff written; continuing in a new session with a fresh context")])
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user