( sessionId: string, title: string, )
| 423 | * @returns Promise<boolean> True if successful, false otherwise |
| 424 | */ |
| 425 | export async function updateSessionTitle( |
| 426 | sessionId: string, |
| 427 | title: string, |
| 428 | ): Promise<boolean> { |
| 429 | try { |
| 430 | const { accessToken, orgUUID } = await prepareApiRequest() |
| 431 | |
| 432 | const url = `${getOauthConfig().BASE_API_URL}/v1/sessions/${sessionId}` |
| 433 | const headers = { |
| 434 | ...getOAuthHeaders(accessToken), |
| 435 | 'anthropic-beta': 'ccr-byoc-2025-07-29', |
| 436 | 'x-organization-uuid': orgUUID, |
| 437 | } |
| 438 | |
| 439 | logForDebugging( |
| 440 | `[updateSessionTitle] Updating title for session ${sessionId}: "${title}"`, |
| 441 | ) |
| 442 | const response = await axios.patch( |
| 443 | url, |
| 444 | { title }, |
| 445 | { |
| 446 | headers, |
| 447 | validateStatus: status => status < 500, |
| 448 | }, |
| 449 | ) |
| 450 | |
| 451 | if (response.status === 200) { |
| 452 | logForDebugging( |
| 453 | `[updateSessionTitle] Successfully updated title for session ${sessionId}`, |
| 454 | ) |
| 455 | return true |
| 456 | } |
| 457 | |
| 458 | logForDebugging( |
| 459 | `[updateSessionTitle] Failed with status ${response.status}: ${jsonStringify(response.data)}`, |
| 460 | ) |
| 461 | return false |
| 462 | } catch (error) { |
| 463 | logForDebugging(`[updateSessionTitle] Error: ${errorMessage(error)}`) |
| 464 | return false |
| 465 | } |
| 466 | } |
| 467 |
no test coverage detected