( transcript: TranscriptMessage[], value: number = 0, summary?: string, customTitle?: string, fileHistorySnapshots?: FileHistorySnapshot[], tag?: string, fullPath?: string, attributionSnapshots?: AttributionSnapshotMessage[], agentSetting?: string, contentReplacements?: ContentReplacementRecord[], )
| 2516 | } |
| 2517 | |
| 2518 | function convertToLogOption( |
| 2519 | transcript: TranscriptMessage[], |
| 2520 | value: number = 0, |
| 2521 | summary?: string, |
| 2522 | customTitle?: string, |
| 2523 | fileHistorySnapshots?: FileHistorySnapshot[], |
| 2524 | tag?: string, |
| 2525 | fullPath?: string, |
| 2526 | attributionSnapshots?: AttributionSnapshotMessage[], |
| 2527 | agentSetting?: string, |
| 2528 | contentReplacements?: ContentReplacementRecord[], |
| 2529 | ): LogOption { |
| 2530 | const lastMessage = transcript.at(-1)! |
| 2531 | const firstMessage = transcript[0]! |
| 2532 | |
| 2533 | // Get the first user message for the prompt |
| 2534 | const firstPrompt = extractFirstPrompt(transcript) |
| 2535 | |
| 2536 | // Create timestamps from message timestamps |
| 2537 | const created = new Date(firstMessage.timestamp) |
| 2538 | const modified = new Date(lastMessage.timestamp) |
| 2539 | |
| 2540 | return { |
| 2541 | date: lastMessage.timestamp, |
| 2542 | messages: removeExtraFields(transcript), |
| 2543 | fullPath, |
| 2544 | value, |
| 2545 | created, |
| 2546 | modified, |
| 2547 | firstPrompt, |
| 2548 | messageCount: countVisibleMessages(transcript), |
| 2549 | isSidechain: firstMessage.isSidechain, |
| 2550 | teamName: firstMessage.teamName, |
| 2551 | agentName: firstMessage.agentName, |
| 2552 | agentSetting, |
| 2553 | leafUuid: lastMessage.uuid, |
| 2554 | summary, |
| 2555 | customTitle, |
| 2556 | tag, |
| 2557 | fileHistorySnapshots: fileHistorySnapshots, |
| 2558 | attributionSnapshots: attributionSnapshots, |
| 2559 | contentReplacements, |
| 2560 | gitBranch: lastMessage.gitBranch, |
| 2561 | projectPath: firstMessage.cwd, |
| 2562 | } |
| 2563 | } |
| 2564 | |
| 2565 | async function trackSessionBranchingAnalytics( |
| 2566 | logs: LogOption[], |
no test coverage detected