mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 18:01:22 +00:00
feat(hooks): add text_delta event for streaming text monitoring
- New text_delta hook event fires for each chunk of streaming text - Enables real-time monitoring of agent output - Plan-mode hook now updates todo progress as [DONE:id] tags stream in - Each todo item has unique ID for reliable tracking
This commit is contained in:
parent
7a03f57fbe
commit
d1eea3ac4e
5 changed files with 57 additions and 5 deletions
|
|
@ -224,6 +224,15 @@ export class AgentSession {
|
|||
|
||||
/** Internal handler for agent events - shared by subscribe and reconnect */
|
||||
private _handleAgentEvent = async (event: AgentEvent): Promise<void> => {
|
||||
// Emit text_delta events to hooks for streaming text monitoring
|
||||
if (
|
||||
event.type === "message_update" &&
|
||||
event.assistantMessageEvent.type === "text_delta" &&
|
||||
this._hookRunner
|
||||
) {
|
||||
await this._hookRunner.emit({ type: "text_delta", text: event.assistantMessageEvent.delta });
|
||||
}
|
||||
|
||||
// When a user message starts, check if it's from either queue and remove it BEFORE emitting
|
||||
// This ensures the UI sees the updated queue state
|
||||
if (event.type === "message_start" && event.message.role === "user") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue