(sessionId: string, data: Record<string, unknown>)
| 132 | }; |
| 133 | |
| 134 | const handleSessionHook = (sessionId: string, data: Record<string, unknown>): void => { |
| 135 | if (shuttingDown) { |
| 136 | return; |
| 137 | } |
| 138 | |
| 139 | const transcriptPath = typeof data.transcript_path === 'string' && data.transcript_path.length > 0 |
| 140 | ? data.transcript_path |
| 141 | : null; |
| 142 | const hookSource = typeof data.source === 'string' ? data.source : null; |
| 143 | const shouldAllowSessionSwitch = hookSource === 'clear'; |
| 144 | |
| 145 | if (!transcriptPath) { |
| 146 | handleSessionFound(sessionId, shouldAllowSessionSwitch); |
| 147 | return; |
| 148 | } |
| 149 | |
| 150 | bindPrimarySession(sessionId, transcriptPath, shouldAllowSessionSwitch); |
| 151 | }; |
| 152 | |
| 153 | const hookServer = await startHookServer({ |
| 154 | onSessionHook: (sessionId, data) => { |
no test coverage detected