( sessionId: string, entry: TranscriptMessage, url: string, )
| 191 | * Ensures sequential execution per session to prevent race conditions |
| 192 | */ |
| 193 | export async function appendSessionLog( |
| 194 | sessionId: string, |
| 195 | entry: TranscriptMessage, |
| 196 | url: string, |
| 197 | ): Promise<boolean> { |
| 198 | const sessionToken = getSessionIngressAuthToken() |
| 199 | if (!sessionToken) { |
| 200 | logForDebugging('No session token available for session persistence') |
| 201 | logForDiagnosticsNoPII('error', 'session_persist_fail_jwt_no_token') |
| 202 | return false |
| 203 | } |
| 204 | |
| 205 | const headers: Record<string, string> = { |
| 206 | Authorization: `Bearer ${sessionToken}`, |
| 207 | 'Content-Type': 'application/json', |
| 208 | } |
| 209 | |
| 210 | const sequentialAppend = getOrCreateSequentialAppend(sessionId) |
| 211 | return sequentialAppend(entry, url, headers) |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * Get all session logs for hydration |
nothing calls this directly
no test coverage detected