(callback: () => void)
| 837 | * Returns an unsubscribe function. |
| 838 | */ |
| 839 | export function onDynamicSkillsLoaded(callback: () => void): () => void { |
| 840 | // Wrap at subscribe time so a throwing listener is logged and skipped |
| 841 | // rather than aborting skillsLoaded.emit() and breaking skill loading. |
| 842 | // Same callSafe pattern as growthbook.ts — createSignal.emit() has no |
| 843 | // per-listener try/catch. |
| 844 | return skillsLoaded.subscribe(() => { |
| 845 | try { |
| 846 | callback() |
| 847 | } catch (error) { |
| 848 | logError(error) |
| 849 | } |
| 850 | }) |
| 851 | } |
| 852 | |
| 853 | /** |
| 854 | * Discovers skill directories by walking up from file paths to cwd. |
no test coverage detected