( sessionId: string, title: string, )
| 517 | * @returns Promise<boolean> True if successful, false otherwise |
| 518 | */ |
| 519 | export async function updateSessionTitle( |
| 520 | sessionId: string, |
| 521 | title: string, |
| 522 | ): Promise<boolean> { |
| 523 | try { |
| 524 | const { accessToken, orgUUID } = await prepareApiRequest() |
| 525 | |
| 526 | const url = buildNoumenaPlatformUrl(`/v1/sessions/${sessionId}`) |
| 527 | const headers = { |
| 528 | ...getOAuthHeaders(accessToken), |
| 529 | 'anthropic-beta': 'ccr-byoc-2025-07-29', |
| 530 | 'x-organization-uuid': orgUUID, |
| 531 | } |
| 532 | |
| 533 | logForDebugging( |
| 534 | `[updateSessionTitle] Updating title for session ${sessionId}: "${title}"`, |
| 535 | ) |
| 536 | const response = await axios.patch( |
| 537 | url, |
| 538 | { title }, |
| 539 | { |
| 540 | headers, |
| 541 | validateStatus: status => status < 500, |
| 542 | }, |
| 543 | ) |
| 544 | |
| 545 | if (response.status === 200) { |
| 546 | logForDebugging( |
| 547 | `[updateSessionTitle] Successfully updated title for session ${sessionId}`, |
| 548 | ) |
| 549 | return true |
| 550 | } |
| 551 | |
| 552 | logForDebugging( |
| 553 | `[updateSessionTitle] Failed with status ${response.status}: ${jsonStringify(response.data)}`, |
| 554 | ) |
| 555 | return false |
| 556 | } catch (error) { |
| 557 | logForDebugging(`[updateSessionTitle] Error: ${errorMessage(error)}`) |
| 558 | return false |
| 559 | } |
| 560 | } |
no test coverage detected