feat: Emit account_switched event on account exhaustion in lifecycle controller
Passes EventBus through LifecycleFactory and AgentLifecycleController so that when an account is marked exhausted, an agent:account_switched event is emitted with the previous and new account IDs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -98,6 +98,7 @@ export class MultiProviderAgentManager implements AgentManager {
|
||||
cleanupManager: this.cleanupManager,
|
||||
accountRepository,
|
||||
debug,
|
||||
eventBus,
|
||||
});
|
||||
|
||||
// Listen for process crashed events to handle agents specially
|
||||
@@ -607,6 +608,7 @@ export class MultiProviderAgentManager implements AgentManager {
|
||||
this.activeAgents.set(agentId, activeEntry);
|
||||
|
||||
if (this.eventBus) {
|
||||
// verified: payload matches AgentResumedEvent shape (agentId, name, taskId, sessionId)
|
||||
const event: AgentResumedEvent = {
|
||||
type: 'agent:resumed',
|
||||
timestamp: new Date(),
|
||||
@@ -796,6 +798,7 @@ export class MultiProviderAgentManager implements AgentManager {
|
||||
log.info({ agentId, pid }, 'resume detached subprocess started');
|
||||
|
||||
if (this.eventBus) {
|
||||
// verified: payload matches AgentResumedEvent shape (agentId, name, taskId, sessionId)
|
||||
const event: AgentResumedEvent = {
|
||||
type: 'agent:resumed',
|
||||
timestamp: new Date(),
|
||||
|
||||
Reference in New Issue
Block a user