registerAll static method
void
registerAll(
- LifecycleManager manager, {
- void onCostUpdate()?,
- void logEntry(
- String warning
- Future<
void> writeBackup()?, - Future<
String?> readFile()?, - List<
String> ? protectedBranches, - void onGitWarning(
- String warning
- void onSecretFound(
- String warning
- int maxToolCallsPerMinute = 120,
- void onRateLimitWarning(
- String warning
- void onRateLimitExceeded(
- String warning
Convenience method to register all built-in lifecycle hooks.
Implementation
static void registerAll(
LifecycleManager manager, {
void Function(int, int, double)? onCostUpdate,
void Function(String)? logEntry,
Future<void> Function(String, String)? writeBackup,
Future<String?> Function(String)? readFile,
List<String>? protectedBranches,
void Function(String)? onGitWarning,
void Function(String)? onSecretFound,
int maxToolCallsPerMinute = 120,
void Function(String)? onRateLimitWarning,
void Function(String)? onRateLimitExceeded,
}) {
if (onCostUpdate != null) {
manager.registerSession(costTracking(onCostUpdate: onCostUpdate));
}
if (logEntry != null) {
manager.registerConversation(auditLog(log: logEntry));
}
if (writeBackup != null && readFile != null) {
manager.registerTool(
fileBackup(writeBackup: writeBackup, readFile: readFile),
);
}
manager.registerTool(
gitSafety(
protectedBranches: protectedBranches ?? ['main', 'master'],
onWarning: onGitWarning,
),
);
if (onSecretFound != null) {
manager.registerTool(secretDetection(onSecretFound: onSecretFound));
}
manager.registerTool(
rateLimiting(
maxToolCallsPerMinute: maxToolCallsPerMinute,
onLimitApproached: onRateLimitWarning,
onLimitExceeded: onRateLimitExceeded,
),
);
}