* Convert session hook matchers to regular hook matchers * @param sessionMatchers The session hook matchers to convert * @returns Regular hook matchers (with optional skillRoot preserved)
( sessionMatchers: SessionHookMatcher[], )
| 280 | * @returns Regular hook matchers (with optional skillRoot preserved) |
| 281 | */ |
| 282 | function convertToHookMatchers( |
| 283 | sessionMatchers: SessionHookMatcher[], |
| 284 | ): SessionDerivedHookMatcher[] { |
| 285 | return sessionMatchers.map(sm => ({ |
| 286 | matcher: sm.matcher, |
| 287 | skillRoot: sm.skillRoot, |
| 288 | // Filter out function hooks - they can't be persisted to HookMatcher format |
| 289 | hooks: sm.hooks |
| 290 | .map(h => h.hook) |
| 291 | .filter((h): h is HookCommand => h.type !== 'function'), |
| 292 | })) |
| 293 | } |
| 294 | |
| 295 | /** |
| 296 | * Get all session hooks for a specific event (excluding function hooks) |