Add emitLastMessage flag to agent.continue()
When calling continue() with emitLastMessage=true, the agent loop emits message_start/message_end events for the last message in context. This allows messages added outside the loop (e.g., hook messages via sendHookMessage) to trigger proper TUI rendering. Changes across packages: - packages/ai: agentLoopContinue() accepts emitLastMessage parameter - packages/agent: Agent.continue(), transports updated to pass flag - packages/coding-agent: sendHookMessage passes true when triggerTurn
This commit is contained in:
@@ -602,8 +602,8 @@ export class AgentSession {
|
||||
message.display,
|
||||
message.details,
|
||||
);
|
||||
// Start a new turn - agent.continue() works because last message is user role
|
||||
await this.agent.continue();
|
||||
// Start a new turn - emit message events for the hook message so TUI can render it
|
||||
await this.agent.continue(true);
|
||||
} else {
|
||||
// Just append to agent state and session, no turn
|
||||
this.agent.appendMessage(appMessage);
|
||||
|
||||
Reference in New Issue
Block a user