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