This commit is contained in:
Dax Raad
2025-06-04 20:49:28 -04:00
parent 160428d2d4
commit d334ead84a
4 changed files with 110 additions and 20 deletions

View File

@@ -384,6 +384,11 @@ ${app.git ? await ListTool.execute({ path: app.path.cwd }, { sessionID: input.se
assistant.cost = usage.cost
assistant.tokens = usage.tokens
await updateMessage(next)
if (text) {
Bus.publish(Message.Event.PartUpdated, {
part: text,
})
}
text = undefined
},
async onChunk(input) {
@@ -397,8 +402,7 @@ ${app.git ? await ListTool.execute({ path: app.path.cwd }, { sessionID: input.se
text = value
next.parts.push(value)
break
}
text.text += value.text
} else text.text += value.text
break
case "tool-call":
@@ -411,6 +415,9 @@ ${app.git ? await ListTool.execute({ path: app.path.cwd }, { sessionID: input.se
args: value.args as any,
},
})
Bus.publish(Message.Event.PartUpdated, {
part: next.parts[next.parts.length - 1],
})
break
case "tool-call-streaming-start":
@@ -423,6 +430,9 @@ ${app.git ? await ListTool.execute({ path: app.path.cwd }, { sessionID: input.se
args: {},
},
})
Bus.publish(Message.Event.PartUpdated, {
part: next.parts[next.parts.length - 1],
})
break
case "tool-call-delta":
@@ -442,6 +452,9 @@ ${app.git ? await ListTool.execute({ path: app.path.cwd }, { sessionID: input.se
state: "result",
result: value.result as string,
}
Bus.publish(Message.Event.PartUpdated, {
part: match,
})
}
break

View File

@@ -168,5 +168,6 @@ export namespace Message {
info: Info,
}),
),
PartUpdated: Bus.event("message.part.updated", z.object({ part: Part })),
}
}