Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 23x 23x 23x 23x 23x 23x 23x | /**
* Lifecycle Factory — Wire up all lifecycle components with proper dependencies.
*
* Creates and configures the complete lifecycle management system with all
* dependencies properly injected. Provides simple entry point for integration.
*/
import { FileSystemSignalManager } from './signal-manager.js';
import { DefaultRetryPolicy } from './retry-policy.js';
import { AgentErrorAnalyzer } from './error-analyzer.js';
import { DefaultCleanupStrategy } from './cleanup-strategy.js';
import { AgentLifecycleController } from './controller.js';
import type { AgentRepository } from '../../db/repositories/agent-repository.js';
import type { AccountRepository } from '../../db/repositories/account-repository.js';
import type { ProcessManager } from '../process-manager.js';
import type { CleanupManager } from '../cleanup-manager.js';
export interface LifecycleFactoryOptions {
repository: AgentRepository;
processManager: ProcessManager;
cleanupManager: CleanupManager;
accountRepository?: AccountRepository;
debug?: boolean;
}
/**
* Create a fully configured AgentLifecycleController with all dependencies.
*/
export function createLifecycleController(options: LifecycleFactoryOptions): AgentLifecycleController {
const {
repository,
processManager,
cleanupManager,
accountRepository,
debug = false
} = options;
// Create core components
const signalManager = new FileSystemSignalManager();
const retryPolicy = new DefaultRetryPolicy();
const errorAnalyzer = new AgentErrorAnalyzer(signalManager);
const cleanupStrategy = new DefaultCleanupStrategy(cleanupManager);
// Wire up the main controller
const lifecycleController = new AgentLifecycleController(
signalManager,
retryPolicy,
errorAnalyzer,
processManager,
repository,
cleanupManager,
cleanupStrategy,
accountRepository,
debug
);
return lifecycleController;
} |