( sessionId: UUID, customTitle: string, fullPath?: string, source: 'user' | 'auto' = 'user', )
| 2615 | /* eslint-enable custom-rules/no-sync-fs */ |
| 2616 | |
| 2617 | export async function saveCustomTitle( |
| 2618 | sessionId: UUID, |
| 2619 | customTitle: string, |
| 2620 | fullPath?: string, |
| 2621 | source: 'user' | 'auto' = 'user', |
| 2622 | ) { |
| 2623 | // Fall back to computed path if fullPath is not provided |
| 2624 | const resolvedPath = fullPath ?? getTranscriptPathForSession(sessionId) |
| 2625 | appendEntryToFile(resolvedPath, { |
| 2626 | type: 'custom-title', |
| 2627 | customTitle, |
| 2628 | sessionId, |
| 2629 | }) |
| 2630 | // Cache for current session only (for immediate visibility) |
| 2631 | if (sessionId === getSessionId()) { |
| 2632 | getProject().currentSessionTitle = customTitle |
| 2633 | } |
| 2634 | logEvent('tengu_session_renamed', { |
| 2635 | source: |
| 2636 | source as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 2637 | }) |
| 2638 | } |
| 2639 | |
| 2640 | /** |
| 2641 | * Persist an AI-generated title to the JSONL as a distinct `ai-title` entry. |
no test coverage detected