feat: Auto-resume idle agents for inter-agent conversations
When an agent asks a question via `cw ask` targeting an idle agent, the conversation router now auto-resumes the idle agent's session so it can answer. Previously, questions to idle agents sat unanswered forever because target resolution only matched running agents. Changes: - Add `resumeForConversation()` to AgentManager interface and implement on MultiProviderAgentManager (mirrors resumeForCommit pattern) - Relax createConversation target resolution: prefer running, fall back to idle (was running-only) - Trigger auto-resume after conversation creation for idle targets - Add concurrency lock (conversationResumeLocks Set) to prevent double-resume race conditions
This commit is contained in:
@@ -254,6 +254,11 @@ export interface TestHarness {
|
||||
*/
|
||||
getPendingQuestions(agentId: string): Promise<PendingQuestions | null>;
|
||||
|
||||
/**
|
||||
* Resume an idle agent to answer a conversation (mock: always returns false).
|
||||
*/
|
||||
resumeForConversation(agentId: string, conversationId: string, question: string, fromAgentId: string): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Get events by type.
|
||||
*/
|
||||
@@ -505,6 +510,9 @@ export function createTestHarness(): TestHarness {
|
||||
|
||||
getPendingQuestions: (agentId: string) => agentManager.getPendingQuestions(agentId),
|
||||
|
||||
resumeForConversation: (agentId: string, conversationId: string, question: string, fromAgentId: string) =>
|
||||
agentManager.resumeForConversation(agentId, conversationId, question, fromAgentId),
|
||||
|
||||
getEventsByType: (type: string) => eventBus.getEventsByType(type),
|
||||
|
||||
getEmittedEvents: (type: string) => eventBus.getEventsByType(type),
|
||||
|
||||
Reference in New Issue
Block a user