( transcript: TranscriptMessage[], value: number = 0, summary?: string, customTitle?: string, fileHistorySnapshots?: FileHistorySnapshot[], tag?: string, fullPath?: string, attributionSnapshots?: AttributionSnapshotMessage[], agentSetting?: string, contentReplacements?: ContentReplacementRecord[], )
| 2639 | } |
| 2640 | |
| 2641 | function convertToLogOption( |
| 2642 | transcript: TranscriptMessage[], |
| 2643 | value: number = 0, |
| 2644 | summary?: string, |
| 2645 | customTitle?: string, |
| 2646 | fileHistorySnapshots?: FileHistorySnapshot[], |
| 2647 | tag?: string, |
| 2648 | fullPath?: string, |
| 2649 | attributionSnapshots?: AttributionSnapshotMessage[], |
| 2650 | agentSetting?: string, |
| 2651 | contentReplacements?: ContentReplacementRecord[], |
| 2652 | ): LogOption { |
| 2653 | const lastMessage = transcript.at(-1)! |
| 2654 | const firstMessage = transcript[0]! |
| 2655 | |
| 2656 | // Get the first user message for the prompt |
| 2657 | const firstPrompt = extractFirstPrompt(transcript) |
| 2658 | |
| 2659 | // Create timestamps from message timestamps |
| 2660 | const created = new Date(firstMessage.timestamp) |
| 2661 | const modified = new Date(lastMessage.timestamp) |
| 2662 | |
| 2663 | return { |
| 2664 | date: lastMessage.timestamp, |
| 2665 | messages: removeExtraFields(transcript), |
| 2666 | fullPath, |
| 2667 | value, |
| 2668 | created, |
| 2669 | modified, |
| 2670 | firstPrompt, |
| 2671 | messageCount: countVisibleMessages(transcript), |
| 2672 | isSidechain: firstMessage.isSidechain, |
| 2673 | teamName: firstMessage.teamName, |
| 2674 | agentName: firstMessage.agentName, |
| 2675 | agentSetting, |
| 2676 | leafUuid: lastMessage.uuid, |
| 2677 | summary, |
| 2678 | customTitle, |
| 2679 | tag, |
| 2680 | fileHistorySnapshots: fileHistorySnapshots, |
| 2681 | attributionSnapshots: attributionSnapshots, |
| 2682 | contentReplacements, |
| 2683 | gitBranch: lastMessage.gitBranch, |
| 2684 | projectPath: firstMessage.cwd, |
| 2685 | } |
| 2686 | } |
| 2687 | |
| 2688 | async function trackSessionBranchingAnalytics( |
| 2689 | logs: LogOption[], |
no test coverage detected