isHookEqual function
Check if two hooks are equal (comparing command/prompt content, not timeout).
Implementation
bool isHookEqual(HookCommand a, HookCommand b) {
if (a.type != b.type) return false;
final sameIf = (a.ifCondition ?? '') == (b.ifCondition ?? '');
if (a is CommandHook && b is CommandHook) {
return a.command == b.command &&
(a.shell ?? defaultHookShell) == (b.shell ?? defaultHookShell) &&
sameIf;
}
if (a is PromptHook && b is PromptHook) {
return a.prompt == b.prompt && sameIf;
}
if (a is AgentHook && b is AgentHook) {
return a.prompt == b.prompt && sameIf;
}
if (a is HttpHook && b is HttpHook) {
return a.url == b.url && sameIf;
}
if (a is FunctionHook) {
return false; // Function hooks can't be compared
}
return false;
}